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