|
-
September 8th, 2009, 11:26 AM
#1
Perform advanced searches in SELECT statement
Hello all
I wanted to ask if there is a way of inserting some mathematics in an SQL select statement.
What I am interested in is to select all rows from a table where 56<ID<67 for example.
Thank you
-
September 8th, 2009, 11:48 AM
#2
Re: Perform advanced searches in SELECT statement
I suggest to do some tutorials about sql. A good one can be found on w3schools.com
The part you are looking for: http://w3schools.com/sql/sql_between.asp
-
September 8th, 2009, 02:46 PM
#3
Re: Perform advanced searches in SELECT statement
Yes there is a way to perform almost every kind of search using SQL, the only condition for that is you should go through some tutorials and do some practice.
-
September 10th, 2009, 11:09 AM
#4
Re: Perform advanced searches in SELECT statement
SO THE TUTORIAL LINK GIVEN SHOWS YOU ...
Code:
SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2
Another way could also be
Code:
SELECT * FROM table_name
WHERE ID > 56 AND ID < 67
-
September 15th, 2009, 12:28 PM
#5
Re: Perform advanced searches in SELECT statement
The difference is that
Code:
column_name BETWEEN value1 AND value2
includes both value1 and value2, so to get the rows such that 56 < ID < 67 (that is not including 56 and 67) you need to use either George1111's alternative or
Code:
... WHERE ID BETWEEN 57 AND 66
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|