mysql - Match value in multiple rows -


i have table 3 columns.

image           ppid    cpid 1st_image.jpg   10395   10019 1st_image.jpg   10395   10371 1st_image.jpg   10395   10311  2nd_image.jpg   10395   10019 2nd_image.jpg   10395   10371 

how can select 1st_image.jpg ppid 10395 , cpid 10019, 10371 , 10311? basically, want select image if cpids match because spread on several rows, cannot select them simple statement.

edit: forgot explicitly mention 2nd_image.jpg should not selected because not match cpid's (10019, 10371, 10311)

select image mytable ppid=10395 , cpid in (10019, 10371 , 10311)


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -