That way you'll only need to update the table addresses, the importance relies into having employers' id as a foreign key.
Title: Mysql INSERT ON DUPLICATE KEY UPDATE
Post by: dada on April 25, 2011, 09:53:14 pm
Yeah that's a good idea, but since he apparently can't get rid of the ID I guess he's working with some system that others rely on and can't be modified very easily. He should do it if possible though.
Title: Mysql INSERT ON DUPLICATE KEY UPDATE
Post by: Pulits on April 25, 2011, 10:13:06 pm
If that's the case:
UPDATE employees SET adress = newadress WHERE id = '1'
There could be more elaborated answers with TRIGGERS and STORED PROCEDURES, I suppose it depends on the complexity of your dB. I'd go with SP, since it can receive parameters ('id', in this case).
Title: Mysql INSERT ON DUPLICATE KEY UPDATE
Post by: Mince Wobley on April 26, 2011, 12:52:13 am
Thanks, I used insert into blah blah blah ignore passing the ID every time I update a record and it quite works