Im doing a search where the POST is: sok3 = 0,2,6
I would then like to select all users that matches this POST(sok3) from table2, where columns could be like this:
table1:
id|name
1 |myname
table2:
id|uid|sok3
0 |1 |0
1 |1 |2
2 |1 |4
3 |1 |6
4 |6 |1
5 |6 |2
6 |6 |4
I have tried with:
SELECT * from table1 as tab1 LEFT JOIN table2 as tab2 ON(tab2.uid = tab1.id) Where ..
The result i get is 3 matches. BUT i only want 1 result, where there is a match. if 0 then its a match, if 0,2 there is match etc..
I know i dont even search for the Post.. just dont know how to solve it :/
How can i solve this one? :)
Either use SELECT DISTINCT name or GROUP BY name in your query