I have the following SQL code:
SELECT widgets.campaign_name, widgets.enddate, widgets.active, widgets.id_widget,COUNT(*) AS entries FROM widgets LEFT JOIN entries ON widgets.id_widget = entries.id_widget WHERE widgets.active IN ( 0 ) AND id_user = 8 GROUP BY widgets.campaign_name
It does exactly what I want to do beside one thing. If I have 0 entries on a campaign, it still shows 1 entry. I want to get rid of this problem and make it count exactly how many entries are. If 0, it should display 0.
The code above works fine for 1,2....n entries.