SELECT
cscart_tags.tag_id,
cscart_tag_links.object_id,
cscart_tag_links.object_type,
cscart_tags.tag,
cscart_tags.status,
COUNT(cscart_tag_links.tag_id) as popularity
FROM
cscart_tags
LEFT JOIN cscart_tag_links ON cscart_tag_links.tag_id = cscart_tags.tag_id
WHERE
1
AND cscart_tag_links.object_type = 'P'
AND cscart_tags.status IN ('A')
AND cscart_tag_links.object_id = 804
GROUP BY
cscart_tags.tag_id
ORDER BY
cscart_tags.tag asc