| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Paul DuBois | Date: | May 13 2003 11:02pm |
| Subject: | Re: count() | ||
| View as plain text | |||
At 15:36 -0700 5/13/03, Eric Anderson wrote: >I'm not sure if I'm just having problems thinking today but if you've >got a field: > >status enum('pending','active','cancelled') NOT NULL default 'pending' > >and you want to get a total of each the entries, is there any way to do >it in one pass, as opposed to: > >select count(*) from <table> where status='pending' >select count(*) from <table> where status='active' >... SELECT status, COUNT(*) FROM tbl_name GROUP BY status; -- Paul DuBois http://www.kitebird.com/ sql, query
| Thread | ||
|---|---|---|
| • count() | Eric Anderson | 14 May |
| • Re: count() | Jeff Shapiro | 14 May |
| • Re: count() | Dan Nelson | 14 May |
| • Re: count() | Paul DuBois | 14 May |
| • RE: count() | Jennifer Goodie | 14 May |
| • Re: count() | Keith C. Ivey | 14 May |
| • Re: count() | (Pete Harlan) | 14 May |
| • Re: count() | Matt Silva | 15 May |
| • Re: count() | Steve Edberg | 14 May |
| • Re: count() | CR | 14 May |
| • Re: count() | Steve Edberg | 14 May |
| • RE: count() | Eric Anderson | 14 May |
| • RE: count() | Mike Hillyer | 14 May |
