SELECT avatar_tag name AS avatar_tag_name avatar_tag id AS avatar_tag_

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SELECT avatar_tag.name AS avatar_tag_name, avatar_tag.id AS avatar_tag_id, count(*) AS count
FROM avatar_avatar_avatar_tag, avatar_tag
LEFT OUTER JOIN (SELECT avatar_avatar.id AS id
FROM avatar_avatar
WHERE (EXISTS (SELECT 1
FROM avatar_avatar_avatar_tag, avatar_tag
WHERE avatar_avatar.id = avatar_avatar_avatar_tag.avatar_avatar_id AND avatar_tag.id = avatar_avatar_avatar_tag.avatar_tag_id AND avatar_tag.name IN (?))) AND avatar_avatar.pending = ?) AS anon_1
ON avatar_avatar_avatar_tag.avatar_avatar_id = anon_1.id
WHERE avatar_tag.id = avatar_avatar_avatar_tag.avatar_tag_id AND avatar_tag.name
NOT IN (?) GROUP BY avatar_tag.id
LIMIT 30 OFFSET 0