+ 4

can we use multiple conditions in single WHERE. ..?

SELECT * FROM customers WHERE id>= 2 AND id <=8 , Age >= 35 AND Age<=40 ;

6th Jul 2016, 2:08 PM
suman siddesh
suman siddesh - avatar
25 Réponses
+ 6
yes you can, but they need to be separated by a logical operator ( ie OR, AND ...) also be careful with the order of the conditions using brackets to nest properly
10th Jul 2016, 2:10 PM
Daniele Valsecchi
Daniele Valsecchi - avatar
+ 3
Yes , You can get multiple condition using seperator by boolean operators like AND , OR , NOT.
13th Jul 2016, 9:21 AM
Suryaprakash Tiwari
Suryaprakash Tiwari - avatar
+ 2
yes, you just need to be aware of how your conditionals are grouped. you would want your where statement to look more like one of these ... WHERE (id BETWEEN 2 AND 8) AND (Age BETWEEN 35 AND 40) --if your database is configured to include the outer values in the result set WHERE (id >= 2 AND id <= 8) AND (Age >= 35 AND Age <= 40) -- if your database will not include the outer values of a between statement in the result set or you aren't sure whether it does
27th Jul 2016, 9:55 PM
wheeler
+ 1
yes
6th Jul 2016, 5:30 PM
sreedhar gupta k
sreedhar gupta k - avatar
+ 1
Yes you can use
8th Jul 2016, 9:15 AM
Manu
+ 1
yes
8th Jul 2016, 11:49 AM
Alok Kushwaha
Alok Kushwaha - avatar
+ 1
yes ofcourse
11th Jul 2016, 5:02 PM
manish rawat
manish rawat - avatar
0
yes
6th Jul 2016, 4:31 PM
Tushar kant Roy
Tushar kant Roy - avatar
0
Yes
7th Jul 2016, 5:42 AM
Luis Arturo Melendez
Luis Arturo Melendez - avatar
0
yes.
7th Jul 2016, 11:12 AM
James McDonald
James McDonald - avatar
0
yes
8th Jul 2016, 6:20 AM
himanshu
0
yes
10th Jul 2016, 4:40 PM
hardik bhola
0
yes
12th Jul 2016, 2:07 PM
Swapnil Rane
Swapnil Rane - avatar
0
yeah
13th Jul 2016, 12:32 AM
Imesh Ekanayake
Imesh Ekanayake - avatar
0
yeah ... obviously
13th Jul 2016, 12:50 AM
Alok Kushwaha
Alok Kushwaha - avatar
0
sure
13th Jul 2016, 3:37 PM
fersado
fersado - avatar
0
yes by using And, Or & Not.
13th Jul 2016, 11:55 PM
Rahul Sharma
Rahul Sharma - avatar
0
Yes
15th Jul 2016, 8:40 AM
Khushi Sharma
Khushi Sharma - avatar
0
yes u can
15th Jul 2016, 12:18 PM
Swapnil Rane
Swapnil Rane - avatar
0
yes
25th Jul 2016, 10:13 AM
Ahmed Babiker Abdalla
Ahmed Babiker Abdalla - avatar