I have a table with three 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 I select the 1st_image.jpg where the ppid is 10395 and the cpid is 10019, 10371 and 10311? Basically, I want to only select the image if all cpids match but because they are spread over several rows, I cannot select them with a simple WHERE statement.
Edit: I forgot to explicitly mention that 2nd_image.jpg should not be selected because it does not match all cpid's (10019, 10371, 10311)