List:General Discussion« Previous MessageNext Message »
From:Chris W Date:May 22 2009 5:22pm
Subject:Update with value form another table
View as plain text  
I have a table with a date value that I need to update with a value from 
another table. 

The table I want to update is profile.  The profile table is linked to 
the study table with the foreign key StudyID.

the profile table has the date I want to update to the value in the date 
value in the study table.

So I can do a simple select like this....

SELECT ProfileID, p.`Date` as `BadDate`, s.`Date` as `GoodDate`
FROM profile JOIN study USING (`StudyID`)

Of course study to profile is a one to many relationship.  How do I run 
an update to set  p.`Date` equal to s.`Date`?

Chris W
Update with value form another tableChris W22 May
  • Re: Update with value form another tablePerrin Harkins22 May