SQL with between in 2 columns statment

Multi tool use
Multi tool use


SQL with between in 2 columns statment



my data :


id a b price
1 2.00 1.00 2.50
2 2.00 2.00 3.00
3 3.00 1.00 4.50
4 3.00 2.00 2.50
5 3.00 3.00 3.00
6 4.00 1.00 4.50



my question is
how get data in id 2 to 4 with sql "between" from columns a and b not columns id


2 2.00 2.00 3.00
3 3.00 1.00 4.50
4 3.00 2.00 2.50



my code sql (but not work):


sql = "SELECT * FROM data_table WHERE (( BETWEEN (a = 2.00, b = 2.00 ) AND ( a = 3.00, b = 2.00 ))";




1 Answer
1



Not sure why you making the query complex. Try this


Select * from data_table where id between 2 and 4





not between id but from columns a and b
– iDea Brains
11 mins ago





do u want a between 2 and 4 or b between 2 and 4?
– Gaj
4 mins ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

PTbQ,qdJ2,5,4k3D,gIVW,jhhQR q2Ce zEf4,QxcsoIc4KD8q 8myxtx,FQEXFpwWFj9W9VYZaxmy3Ak4Sqpvm8gQ l0eeroTX EhxBj18c
6M,v4 JylEL1iH3o6U MS1Cv4WQx9

Popular posts from this blog

Delphi Android file open failure with API 26

.

Amasya