List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 3 2000 5:14pm
Subject:Re: Grouping blues
View as plain text  
At 10:56 AM -0400 10-03-2000, Mynarski, Boleslaw  [CPCUS] wrote:
>Is it possible (I guess it is) to do more than just a simple grouping query?
>That's what I have in mind:
>
>SELECT t1.c1, COUNT(*) AS Total
>FROM t1 LEFT JOIN t2
>ON t1.c2 = t2.c2
>WHERE t2.c2 IS NULL
>GROUP BY t1.c1
>ORDER BY Total DESC
>
>O.K.  That's straight forward.  What I have in mind is a stepping report, so
>from the very left I would have (let's use country, city):
>
>Grouped by country
>	Grouped by city within the country
>
>Is this possible to do without any special mental gymnastics?  The reason
>why I ask about it is because I wrote a PERL backend to the web interface
>and this is a missing jewel in my crown.  I'm not sure how to write such a
>query in MySQL.
>
>Thanks.

You're asking for both a summary, and a list.  You need multiple queries.

-- 
Paul DuBois, paul@stripped
Thread
Grouping bluesBoleslaw  [CPCUS] Mynarski3 Oct
Re: Grouping bluesPaul DuBois3 Oct
RE: Grouping bluesBoleslaw  [CPCUS] Mynarski3 Oct