Function
count () always returns a value (even if it is zero), the problem is that in one of your tables there are no corresponding rows. You need to do an outer join to include rows from both tables. Check which table has no rows, then add an outer join to include all rows from another table.
SELECT s.created_at, COUNT (o.subscription_id)
FROM subscriptions s
LEFT OUTER JOIN order o // (Depending on situation, it can be RIGHT OUTER JOIN)
ON (s.id = o.subscription_id)
GROUP BY s.created_at
If you still have problems, send the data of your tables.
source share