[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Interesting SQL Query - Total and Grouped Counts together?
From:       "Imran Chaudhry" <ichaudhry () gmail ! com>
Date:       2007-04-30 14:09:12
Message-ID: 542391be0704300709i12021ddbu8511cb17d6945c78 () mail ! gmail ! com
[Download RAW message or body]

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@atomdatabase.com
http://atomdatabase.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic