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
I'm wondering if any of you can assist with an interesing SQL
query. I have a single table within a database, the relevant fields of
which are defined as:
CREATE TABLE tableA
(
domain text,
mime text
);
Where domain is a domain, such as:
Hi,
Imran Chaudhry wrote:
I'm wondering if any of you can assist with an interesing SQL
query. I have a single table within a database, the relevant fields of
which are defined as:
CREATE TABLE tableA
(
domain text,
mime text
);
Where
On Thu, April 26, 2007 18:38, Baron Schwartz wrote:
Hi,
Imran Chaudhry wrote:
I'm wondering if any of you can assist with an interesing SQL
query. I have a single table within a database, the relevant fields of
Try IF or CASE expressions:
SELECT foo, count(*), sum(case when foo = 'bar'