Modify SQL query to include cases without a value

You can left join:

select,, count(p.categoryid) cnt_products
from category c
left join product p on p.categoryid =
group by;

A correlated subquery is also a fine solution, which avoids outer aggregation:

select c.*,
    (select count(*) from product p where p.categoryid = cnt_products
from category c

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top