Link to home
Start Free TrialLog in
Avatar of brihol44
brihol44

asked on

MYSQL LEFT JOIN matching tables including WHERE on LEFT JOINED table is returning 0 results.

I have a two tables...

Categories and Songs...

SELECT *
FROM categories t1
LEFT JOIN songs t2
ON t1.category_id = t2.song_id
WHERE t2.song_status != 'pending'
AND t2.song_status != 'inactive'
AND t2.song_status != 'studio'

problem is that I still want to show the categories even if there are no records... when I remove the WHERE I get what I want but obviously it's checking song_status and it doesn't exist from the LEFT JOIN.

Thanks for the help!
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial