“SQL query to match the data in the passed comma sepearted string”
March 26, 2008
There are several occasions when we have to match whether a passed collection of id is there in the database or not , in this case we can design the SQL in such a fashion that it checks for the id = (1,2,3), so for that we need to use IN operator.
Eg:
select * from table_name where table_name.id IN (array of integer or anything else)
Now here the array of integer or anything else should be in a comma separated manner like (1,2,3) or (’asa’,’sa’,’sasa’)
Entry Filed under: SQL, mysql. Tags: in join, mysql, search mysql from a array, SQL.
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed