Reputation: 212
I have a Table in SQL Server 2012 Database called TblAccttAssistant. It has the below Data Values as shown in image:-
I want to use Sql Query to Select a Single value based for PPO_From and PPO_To column values range:
Select * from TblAccttAssistant where (ppo_from >=2500 ANd ppo_to<=2500)
I have to provide a single value 2500 to query. It is getting 0 No of Rows.
Upvotes: 1
Views: 1048
Reputation: 17
Select * from TblAccttAssistant where (ppo_from <=2500 ANd ppo_to>=2500)
Upvotes: 0
Reputation: 347
You're probably looking for the BETWEEN operator?
SELECT * FROM TblAccttAssistant WHERE 2500 BETWEEN ppo_from AND ppo_to
Your query doesn't work because there is no row satisfying both of your WHERE-conditions.
Upvotes: 1