I just inherited an application that has 2 tables under consideration, "events" and "attribute_master". They are linked on (events.eventID = attribute_master.id AND attribute_master.tableis = 'events'). In other words, attribute_master.id is kinda like a foreign key to events.eventID, but only where attribute_master.tableis = 'events'.

I have ommited some columns from 'events' that I am fairly certain are NT germane to my question:

CREATE TABLE attribute_master (

tableis varchar(128) NT NULL default '',

id int(12) NT NULL default '0',

attributeID int(8) NT NULL default '0',

PRIMARY KEY (tableis,id,attributeID)

) TYPE=MyISAM;

CREATE TABLE events (

eventID mediumint(9) NT NULL auto_increment,

eventReview text NT NULL,

status tinyint(1) NT NULL default '0',

modlast int(8) NT NULL default '0',

PRIMARY KEY (eventID)

) TYPE=MyISAM

Now, an intersting query:

SELECT

events.eventID AS id,

attribute_master.attributeID AS attrib_id

FRM

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'

GRUP BY

attribute_master.id

So here's my question(s): Given this query, how can on GRUP BY operate on a column that doesn't appear in the SELECT list? Secondly, I thought that every column listed in the SELECT clause would have to be in an aggregate function or mentioned in the GRUP BYhow am I wrong?