Re: showing zero counts in select statements with group by

2006-02-18 Thread Peter Brawley
Sorry, two errors, should be ... ...) OR m.repyear IS NULL GROUP BY c.year PB - Chris Fonnesbeck wrote: On 2/17/06, Peter Brawley <[EMAIL PROTECTED]> wrote: Chris, Your WHERE clause is weeding out the NULL joined entries. Try something like... select m.repyear as repyear,

Re: showing zero counts in select statements with group by

2006-02-17 Thread Dan Nelson
In the last episode (Feb 17), Chris Fonnesbeck said: > I am trying to figure out how to get a comprehensive count of rows in > a database by year. Unfortunately, when there are no rows for a > particular year, the year is omitted from the result set, rather than > showing up with a zero count: > >

Re: showing zero counts in select statements with group by

2006-02-17 Thread Peter Brawley
Chris, Your WHERE clause is weeding out the NULL joined entries. Try something like... select m.repyear as repyear, count(*) as count from years y left join mortality m on y.year=m.repyear where ( m.region like 'Southwest' and m.repyear>1985 and m.dthcode!=4 and (m.cause like '%red tide%' or m

showing zero counts in select statements with group by

2006-02-17 Thread Chris Fonnesbeck
I am trying to figure out how to get a comprehensive count of rows in a database by year. Unfortunately, when there are no rows for a particular year, the year is omitted from the result set, rather than showing up with a zero count: mysql> select count(*) as count, repyear from mortality where re