| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Imran Chaudhry | Date: | April 30 2007 2:09pm |
| Subject: | Re: Interesting SQL Query - Total and Grouped Counts together? | ||
| View as plain text | |||
Baron,
Thanks very much for that simple but very effective solution.
I altered your SQL slightly, the final SQL looks like this:
SELECT
domain,
count(*) AS 'count all',
SUM(IF(mime = 'text/html', 1, 0)) AS 'count text',
SUM(IF(mime LIKE 'image/%', 1, 0)) AS 'count image'
FROM
tableA
GROUP BY
domain
ORDER BY
domain
Thanks again,
Imran Chaudhry
--
Atom Database
A Custom Database Designed for Your Business
info@stripped
http://atomdatabase.com
| Thread | ||
|---|---|---|
| • Interesting SQL Query - Total and Grouped Counts together? | Imran Chaudhry | 26 Apr |
| • Re: Interesting SQL Query - Total and Grouped Counts together? | Baron Schwartz | 26 Apr |
| • Re: Interesting SQL Query - Total and Grouped Counts together? | Mogens Melander | 26 Apr |
| • Re: Interesting SQL Query - Total and Grouped Counts together? | Imran Chaudhry | 30 Apr |
