Donna, Just to say thanks.
Played a bit more with the code and options and got most of what I wanted. A little procedure gives me the rest. Many thanks for pointing me in the right direction. Kerry -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 28 November 2006 20:56 To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: SELECT...GROUP BY WITHIN GROUP BY I'm not sure that this is exactly what you want, but I think you can use the WITH ROLLUP modifier: select district, town, street, surname, count(surname) from test5 group by district asc, town asc, street asc, surname asc WITH ROLLUP Here's a link to the MySQL documentation on WITH ROLLUP http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html Donna -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]