Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I have doubt in executing a query.
I want display 2 different records whose CTC is above 2L and below 2L.
So have crafted 2 different query with < and > symbol.
Is there any way to get a record on one time execution, such as executing the query at 1 time with different symbol.

Kindly guide me on this.
SQL
Select * from CTC_Table with (Nolock) where CTC<200000
Select * from CTC_Table with (Nolock) where CTC>200000
Posted
Updated 31-Jan-13 19:32pm
v3
Comments
Santhosh Kumar Jayaraman 1-Feb-13 1:37am    
Please be more clear
__TR__ 1-Feb-13 1:40am    
You can use a dynamic query.
Execute Dynamic SQL commands in SQL Server[^]

1 solution

SQL
Select * from CTC_Table where CTC < 200000 or CTC > 200000;


will do it
in this particular instance, you could also use
SQL
Select * from CTC_Table where CTC <> 200000;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900