Update with value form another table

Update with value form another table

am 22.05.2009 19:22:06 von Chris W

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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Update with value form another table

am 22.05.2009 21:08:46 von Perrin Harkins

On Fri, May 22, 2009 at 1:22 PM, Chris W <4rfvgy7@cox.net> wrote:
> Of course study to profile is a one to many relationship. =A0How do I run=
an
> update to set =A0p.`Date` equal to s.`Date`?

This is covered in the docs for UPDATE. Read that and come back if
you're stuck.

- Perrin

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg