Hi all! I need to perform what I've called an "additive UPDATE". The logic is the next:
(1) There's a historic table (HISTORY) with two fields: mysql> create table history (ID char(7) primary key, VAL int(12));
(2) There's a new table everyday (TODAY) with exactly the same structure as HISTORY (ID and VAL).
(3) I need to feed HISTORY with the values found in TODAY in an "additive" way. I think that the pseudocode would be like this: * IF TODAY.id EXISTS IN HISTORY.id - THEN UPDATE HISTORY.val = HISTORY.val + TODAY.val * ELSE UPDATE HISTORY.id = TODAY.id, HISTORY.val = TODAY.val ... you see now why I called it an additive UPDATE? :)
Is there a way to perform this with just MySQL or do I need to combine it with a programming language? Thanks in advance, Hector
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]