Frank, try this:

SELECT Placename, Month, Count(*)
FROM YOURTABLE
GROUP BY Placename, Month
ORDER BY Placename, Month

Keep in mind, however, that the above query would place the Month column in
alphabetical order, not in chronological order.  To overcome this, you may
wish to change month to a number where JAN => 1, FEB => 2, ... , DEC => 12.

Hope this helps!

Michael Hanna
Industrial Engineering
United Parcel Service Canada Ltd.
(905) 660-8688


-----Original Message-----
From: frankbarrett [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 10:51 AM
To: [EMAIL PROTECTED]
Subject: MI-L MI SQL query question.


Dear listeners,

I have a query question. I have a table with place names and dates(see
below).
A number of occurrences of a place name can occur within the same month.
I wish to summarise the table in terms of the counts for each place for each
month. I know what the query should give me i.e. what my final table should
look
like (see below). Any suggestions on how to formulate the query. This is
most likely
a really simple query but I cant figure it.

Thanks in advance for your time


Table                                   Desired outcome
Placename       Month                   Placename       Month   Count
A               Jan                     A               Jan             4
B               Jan                     A               Feb             1
B               Feb                     B               Jan             1
A               Jan     ------> B               Feb             2
A               Jan
A               Jan
A               Feb
B               Feb

Frank Barrett.



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to