SELECT a, b, c, SUM(d)  FROM a GROUP BY a,b

this will not work however because c isn't contained either in the group by 
or a function.

Try either:
SELECT a, b, c, SUM(d)  FROM a GROUP BY a,b,c

or

SELECT a, b, max(c), SUM(d)  FROM a GROUP BY a,b

depending on your needs

-----Original Message-----
From: Gabor PENOFF [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 11:59 AM
To: [EMAIL PROTECTED]
Subject: GROUP by multiple columns [id:fns]


Hi folks,

I need a select groupped by more than one field like:

SELECT a, b, c, SUM(d)  FROM a GROUP BY CONCAT(a,b)

- but it doesn't work (MySQL 3.22). Is it poissible somehow?

cu,
fns
-[ mailto:[EMAIL PROTECTED] http://www.megaram.hu/~fns icq:878397 ]-
              -[ Zavart erzek az eroben... :) ]-


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to