Is it possible to do an insert into with subselect and group by with an
additional on duplicate insert ?

CREATE TABLE NEW_TABLE (
 `a` varchar(10),
 `b` double
) engine=MyISAM;


INSERT INTO NEW_TABLE (select old.x,sum(old.y) from OLD_TABLE old group by
old.a)
 on duplicate key
 update b=sum(old.y);

I get invalid group by clause on that.

Currently I achieve the same thing using two seperate queries, but wondered
if I could consolidate as they take ~ 30mins in total (much more complex
tables).

Anyway, more curious than anything on why it's disallowed and if it's just
something silly I'm missing.

Phil


-- 
Help build our city at http://free-dc.myminicity.com !

Reply via email to