I have a table like;
tablea
4c4fedf7 OMoy3Hoa
4c4fedf7 yiWDGB4D
broe4AMb A9rLRawV
broe4AMb mi9rLmZW
nhrtK9ce yEsBoYLj
rEEtK9gt A9rLRawV
rEEtK9gt mi9rLmZW
rEEtK9Hh A9rLRawV
rEEtK9Hh msBWz8CQ
If I give the input like A9rLRawV
,mi9rLmZW
. I want an output like;
broe4AMb
rEEtK9gt
The output is generated as a result of A9rLRawV
,mi9rLmZW
combination. Here, broe4AMb
and rEEtK9gt
both have A9rLRawV
and mi9rLmZW
associated in tablea. I made a query, but I get output like;
broe4AMb
rEEtK9gt
rEEtK9Hh
My query is like;
SELECT DISTINCT prodid
FROM tablea
WHERE tagid IN ('A9rLRawV','mi9rLmZW');
The output is like this because I think, reetK9Hh
has A9rLRawV
associated with it in tablea. But i don't want that entry to appear because it doesn't have mi9rLmZW
associated with it.
Here is the SQL fiddle http://sqlfiddle.com/#!9/12223/2/0
Does it require a SELF JOIN. What will be the most 'efficient' method? Is it possible to achieve this with MySQL alone or with support of PHP? How can I do this / fix this?