breeze351
asked on
Update from TABLE-A to TABLE-B
I need to update data from TABLE-A to TABLE-B. I have the correct query for TABLE-A. Is there a quick way do this without set.
ASKER
That would work for an INSERT, but what about UPDATE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IIRC MySQL has REPLACE INTO that might do what you want. I'm not sure what DB you're using, but this is not really a PHP question.
As far as I remember a REPLACE INTO does a delete and insert - if you have auto id's they will change. (http://dev.mysql.com/doc/en/replace.html). ON DUPLICATE KEY does not do this.
However if the intention here is to save some typing on the SET commands it might be better to write a wrapper function that simply takes an array of data and converts it into a SET query.
Let us know if that is the motivation and we can post code.
However if the intention here is to save some typing on the SET commands it might be better to write a wrapper function that simply takes an array of data and converts it into a SET query.
Let us know if that is the motivation and we can post code.
SELECT * FROM table-a;
HTH,
Dan