
(Main table id equal to jid. Join based on that.)
The 1st item has got 2 row in the join table. /That’s great./
But 3rd item has got no row in join table.
The question: How can i ignore those items that has got no joined rows? IN ONE QUERY.
I tried the following:
SELECT *
FROM mainTable AS mainT
LEFT JOIN joinTable AS joinT ON mainT.id=joinT.jid
WHERE COUNT(joinT.id) > 0
Replace
LEFT JOINwithINNER JOIN, and remove theWHEREclause.