Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a sql table city where the columns is

id city
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I

now m searching cities and my parameters is the format of
@city = 1,3,4

how to search it
Posted

You can use IN Operator in SQL and the IN operator allows you to specify multiple values in a WHERE clause.
Check Using comma separated value parameter strings in SQL IN clauses Code Project article.
 
Share this answer
 
v2
Use IN Operator:-
The IN operator allows you to specify multiple values in a WHERE clause.

eg:-
1]
SQL
SELECT * FROM TblName WHERE City IN ('A','C','D');

Or
2]
SELECT * FROM TblName WHERE ID IN ('1','3','4');
 
Share this answer
 
Comments
@p@richit 11-Aug-14 5:53am    
thanks for reply its working.
TrushnaK 11-Aug-14 8:09am    
you are welcome...

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