Can't seem to get this working. If the count is null I want to set it to zero... else set it to the count. I am adding multiple counts in another part of my code so I cannot have null values when I do this.
$table = " ...
LEFT JOIN
(SELECT user_id, IF(count(user_id) = '(null)',0,count(user_id)) as t1count
FROM screenshot_logs
GROUP BY user_id) as t_screenshots
on t_screenshots.user_id = users.user_id
...
";