Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating field with contents of temporary field

Status
Not open for further replies.
Jul 28, 2005
358
FR
Hi,

I have a table, that when new information is entered for it the new info is held in a temporary table that has exactly the same fields (the only difference is the auto increment pid in the original table is not auto increment in the temporary one - it holds the pid from the original).

I need to be able to update the original with the contents of the temporary field, all fields are updated.

Is there an easy way to do this, or will I need to select from the temporary and then run the update setting all the fields explicitly.

I have tried something like
Code:
Update villas   SELECT *  FROM updatevilla WHERE pid='$villapid'
[/code ] in php but it doesn't work. I think I see what some of the problem is but am not sure how to fully write the query.

Thanks

Richard
 
I meant I want to update a record with the contents of a temporary record. Not field.

Richard
 
You can say:[tt]
REPLACE villas SELECT ...
[/tt]
That would insert the record into the table, overwriting any record which has a duplicate unique-key value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top