Q&A about the site for administrators, end users, developers and designers for Craft CMS
WITH temp_table AS( SELECT * FROM Posts WHERE OwnerUserId IS NOT NULL ) SELECT u.Id, SUM(t.Id) AS pocet_postu FROM Users u LEFT JOIN temp_table t ON u.Id = t.OwnerUserId WHERE t.OwnerUserId IS NULL GROUP BY u.Id;