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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE using sub-queries.

Status
Not open for further replies.

vickersdc

IS-IT--Management
May 15, 2001
119
GB
I've exported a database from Access into Excel, but as the person who created the Access database appeared to be not too literate in normalisation, etc. I now have to rebuild some of the structure.

On of the stages in this rebuild requires me to populate the value in one table with the value held in another, based on two other values being equal. Does that make sense?! Here's the SQL...

update tblmaintenance
set system_id = ( select system_id
from tblsystems
where tblsystems.system_name = tblmaintenance.System_Name )
where exists ( select *
from tblsystems
where tblsystems.system_name = tblmaintenance.System_Name );

...but it doesn't work in MySQL v3.23.37. Any ideas??

Cheers,
Dave V.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top