Mark Hughes wrote:
> Hi Lyle,
> You could try the 'INSERT ... ON DUPLICATE KEY UPDATE' syntax
>
> http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
>
> Something like:
>
> insert into new_table  select * from old_table on duplicate key update
> new_table.totalamount = new_table.totalamount + old_table.totalamount;
>
> Or if old_table doesn't have any unique rows, or you don't want to add
> them to new_table just use a multiple table update
>
> update new_table  set new_table.totalamount = new_table.totalamount +
> old_table.totalamount where new_table.id = old_table.id

That sounds pretty interesting. I'll have a play about with it and see 
what I can get working... Thanks for the pointer.


Lyle

_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to