dbTalk Databases Forums  

GROUP BY *column* when *column* is NOT in SELECT list?

mailing.database.myodbc mailing.database.myodbc


Discuss GROUP BY *column* when *column* is NOT in SELECT list? in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default GROUP BY *column* when *column* is NOT in SELECT list? - 05-11-2006 , 05:34 PM






Hello all,

I have inherited this query:

SELECT
events.eventID AS id,
attribute_master.attributeID AS attrib_id
FROM
events,
attribute_master
WHERE
events.status=3D'8' AND
events.eventReview!=3D'' AND
events.modlast > 1146470445 AND
events.eventID =3D attribute_master.id AND
attribute_master.tableis =3D 'events'
GROUP BY
attribute_master.id


I thought that every column listed in the SELECT clause would have to be =
in an aggregate function or mentioned in the GROUP BY...how am I wrong?

--
Wellington

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: GROUP BY *column* when *column* is NOT in SELECT list? - 05-11-2006 , 05:53 PM






At 18:28 -0400 5/11/06, Fan, Wellington wrote:
Quote:
Hello all,

I have inherited this query:

SELECT
events.eventID AS id,
attribute_master.attributeID AS attrib_id
FROM
events,
attribute_master
WHERE
events.status='8' AND
events.eventReview!='' AND
events.modlast > 1146470445 AND
events.eventID = attribute_master.id AND
attribute_master.tableis = 'events'
GROUP BY
attribute_master.id

I thought that every column listed in the SELECT clause would have
to be in an aggregate function or mentioned in the GROUP BY...how am
I wrong?
It's a MySQL extension to GROUP BY:

http://dev.mysql.com/doc/refman/5.0/...en-fields.html

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.