This query returns entries with 4 columns: id , alias , name , status .
SELECT DISTINCT t.id, t.alias, t.name, CASE WHEN at.tag_id IS NULL THEN 0 ELSE 1 END AS status FROM tbl_tag t LEFT JOIN tbl_article_tags at ON t.id = at.tag_id How to add a condition WHERE status = 1 ? If you add it, then mysql gives an error:
# 1054 - Unknown column 'status' in 'where clause'