List:General Discussion« Previous MessageNext Message »
From:Laercio Xisto Braga Cavalcanti Date:September 27 2004 12:02pm
Subject:RE: update data according to value in other table
View as plain text  
Hy Kerry,

Try WHERE EXISTS Clause.

Regards,

Laercio.
 

-----Original Message-----
From: Kerry Frater [mailto:kerry@stripped] 
Sent: domingo, 26 de setembro de 2004 18:14
To: "MySQL List"
Subject: update data according to value in other table

Can someone tell me if this is possible using the UPDATE command

I have a table MASTER and a table called MASTERNOTES. Masternotes contains
the blobs of data linked to MASTER that is stored separately for efficiency.
Not all rows in MASTER has a note and therefore MASTERNOTES is a subset of
MASTER.

I want to add a column in MASTER HaveANote. The value is 'Y' if a note
exists in MASTERNOTES and 'N' if not.

I was wondering if this can be done using UPDATE. The manual doesn't have
any examples that I can see showing an UPDAT if ... example.

In pseudo terms I am looking to do
UPDATE MASTER
SET HaveANote = 'Y' IF MATTERREF EXISTS IN MASTERNOTES

I know how to write this in a program to update the table would like to know
how to do it using SQL syntax.

Thanks

Kerry

Thread
update data according to value in other tableKerry Frater26 Sep
  • Re: update data according to value in other tableMichael Stassen27 Sep
    • RE: update data according to value in other tableKerry Frater27 Sep
  • RE: update data according to value in other tableLaercio Xisto Braga Cavalcanti27 Sep