how to get multiple row with mysql IN statements

user5826068 :

Hi i have editid column as shown below. From these i want to get result row only as 3,0 and 3089,3,0 if i pass 3. For eg:

SELECT * FROM `master_bom3` WHERE 3 IN(
`editid`
)

But am getting only one row as the result ie 3,0 only.

editid column
0
1,0
3087,0
3,0
3089,3,0
3081,0
forpas :

You can do it with FIND_IN_SET():

SELECT * 
FROM `master_bom3` 
WHERE FIND_IN_SET(3, `editid`)

See the demo.
Results:

| editid   |
| -------- |
| 3,0      |
| 3089,3,0 |

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=171007&siteId=1