Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query to return ALL rows even those with zero counts

561916Feb 14 2007 — edited Feb 19 2007
Hi,

The following query will return only those rows that have a non zero count value:
select c.id, a.name, count(*) as XYZ from CON c, CUST a
where c.help !='1' and (c.id = a.id) group by c.id, a.name order by c.id;

The results are:
1 ME 3
3 YOU 4

What i want is to return all rows in CUST and the count, XYZ, that correspond to each row in CUST that matches the whare condition above, even if the count is zero.
ie
1 ME 3
2 WE 0
3 YOU 4

Can this be done?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 19 2007
Added on Feb 14 2007
9 comments
1,953 views