Reputation: 455
Select *
FROM dummytable
WHERE
( minagegrp >=7 AND minagegrp <= 9)
OR ( maxagegrp >= 7 AND maxagegrp <= 9 )
OR (minagegrp <= 7 AND maxagegrp >= 9 )
ORDER BY apptitle DESC
I am actually not able to understand why is this query not returning me result properly.
Condition is -: Return those rows which have either of the given conditions true.
Please help !!
Upvotes: 0
Views: 405
Reputation: 9904
So many conditions not required. Below itself would solve your issue:
Condition 1 says:
Min value = 7,8,9
Condition 2 says :
Max value = 7,8,9
Condition 3 says:
Min <7 or Max > 9
So, The below query would help you achieve your result.
Select * FROM dummytable
where minagegrp <=9
or maxagegrp >= 7
Upvotes: 2