SELECT "e".*, "c"."name" AS "c_name", COUNT(o.id) AS "object_cnt" FROM "expo" AS "e" INNER JOIN "country" AS "c" ON c.id = e.countryid LEFT JOIN "object" AS "o" ON o.on_expo_id = e.id WHERE (e.siteid = :siteid AND is_invisible = false AND (periodstart < 1679513850 AND date_trunc('day', to_timestamp(periodend+86400)) >= date_trunc('day', to_timestamp(1679513850)) OR only_online = true)) GROUP BY "e"."id", "e"."name", "start_date", "end_date", "e"."siteid", "e"."address1", "e"."address2", "e"."address3", "premium", "zipcode", "date_updated", "c"."name" ORDER BY "periodstart" DESC