SELECT "t".*,
(SELECT COUNT(*) FROM "user_archive_view" WHERE user_tariff_id = t.id) AS "count_archive"
FROM "user_tariff" "t" HAVING "count_archive"='100';
SELECT "t".*,
(SELECT COUNT(*) FROM "user_archive_view" WHERE user_tariff_id = t.id) AS "count_archive"
FROM "user_tariff" "t"
HAVING (SELECT COUNT(*) FROM "user_archive_view" WHERE user_tariff_id = t.id) = '100';