MySQL Forums
Forum List  »  Newbie

insert select with on duplicate key
Posted by: Nopere Mike
Date: June 16, 2005 03:56AM

Hi,

In first sorry for my poor english,
I am on mysql 4.1.12
I have a little problem , i would like do this :

Insert into t1
select a,b,count(*) as d from t2
group by a
on duplicate key update c= c+d;

in fact , i would like insert into t1 all the t2 table , and if is exist update de c rows with the result of count(*) from table t2

If i can do this or if you have any idee for my probleme

Thx a lot ;)

Options: ReplyQuote


Subject
Written By
Posted
insert select with on duplicate key
June 16, 2005 03:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.