Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: ambiguous col
03-26-2013, 12:24 PM #1
- Join Date
- Dec 2005
- Thanked 78 Times in 78 Posts
id is key
insert into test select t1.id,@variable := t1.col from test t1 on duplicate key update col = col + @variable
insert into test t select t1.id,t1.col from test t1 on duplicate key update t.col = t.col + t1.col
03-26-2013, 08:21 PM #2
Yes, I got that, too.
But here's a sneaky way around it:
Code:CREATE VIEW testview AS SELECT id, col AS viewcol FROM test; INSERT INTO test SELECT id, viewcol FROM testview ON DUPLICATE KEY UPDATE col = col + viewcol;
Be yourself. No one else is as qualified.