I want to select rows with using inner join to another table.
SELECT COUNT(t3.ID), t3.act, t3.dj_id, t1.ID,
t1.name, t1.label_id, t1.date, t1.genre,
t1.plink, t1.featana, t1.promo_aktif
FROM `release` t1
INNER JOIN `acts` t3 ON t3.release_id = t1.ID
WHERE t1.ID IN ($lst) AND t1.promo_aktif = 'Active'
AND t3.act = 'hide' AND t3.dj_id = '$id'
HAVING COUNT(t3.ID) = 0
ORDER BY t1.ID DESC
LIMIT 0,15
In this query, result is empty. it selects 0 rows. but i am sure there are rows with this conditions.
query needs to select rows in t1 when there is no record found in t3
where am i wrong in this query ?
thanks
EDIT
correct code is
SELECT t3.act, t3.dj_id, t1.ID,
t1.name, t1.label_id, t1.date, t1.genre,
t1.plink, t1.featana, t1.promo_aktif
FROM `release` t1
LEFT JOIN `acts` t3 ON t3.release_id = t1.ID AND t3.act = 'hide' AND t3.dj_id = '$id'
WHERE t1.ID IN ($lst) AND t1.promo_aktif = 'Active'
AND t3.release_id is null
ORDER BY t1.ID DESC
LIMIT 0,15
correct code is