Hello all, 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 NOT germane to my question: CREATE TABLE attribute_master ( tableis varchar(128) NOT NULL default '', id int(12) NOT NULL default '0', attributeID int(8) NOT NULL default '0', PRIMARY KEY (tableis,id,attributeID) ) TYPE=MyISAM; CREATE TABLE events ( eventID mediumint(9) NOT NULL auto_increment, eventReview text NOT NULL, status tinyint(1) NOT NULL default '0', modlast int(8) NOT NULL default '0', PRIMARY KEY (eventID) ) TYPE=MyISAM #### Now, an intersting 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 So here's my question(s): Given this query, how can on GROUP 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 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/[EMAIL PROTECTED]