Forum Moderators: coopster

Message Too Old, No Replies

update records in db

delete then re-insert can't be the most efficient

         

jamie

8:15 pm on Sep 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

i have a relational table of page URLs and advert IDs.

i have an admin back office where i use a multiple select form to choose which ads to display on which pages.

currently i delete all page records for the advert in question and then reinsert all the new page/advert relations.

however, there must be an easier way!

is there some cool subselect-multiple-conditional-insert type command to do all this in one go?

i am sure most of you have come across this situation, i would really appreciate some other opinions - my way seems so clumsy.

thanks a lot!

mcibor

12:39 pm on Sep 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't see why you delete and the reinsert?
Use the UPDATE command:

UPDATE table SET value='New value' WHERE id='1' LIMIT 1;

Sorry, but I don't quite follow what you're doing.
Best regards
Michal Cibor