What is a SQL statement that can tally up the counts even including the Zeros? (all in 1 statement)

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-04-23T19:25:09Z Indexed on 2010/04/23 19:33 UTC
Read the original article Hit count: 251

Filed under:
|
|
|

A SQL statement can give a list of the most popular gifts that are sent in a Social application, all the way to the ones that are sent 1, or 2 times, but it won't include the Zeros.

I think the same goes for getting the list of the most popular Classes that students are registering for, when the registration process for all students is 10 days and now it is the 3rd day. Again, we get the count but the Zeros are not there.

Is there a simple SQL statement that can show the whole list, including the zeros?

© Stack Overflow or respective owner

Related posts about sql

Related posts about join