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!

sql delete

Status
Not open for further replies.

ttuser4

MIS
Jun 19, 2008
147
CA
hi,

i want to delete records from one table (bays_jun18) where there are no associated records in the second table (loadup2). There are three fields - span, type, length - have to match, if they don't match then delete record.



Error

SQL query:

DELETE bays_jun18. * FROM bays_jun18 p LEFT JOIN loadup2 pp ON p.type = pp.type AND p.length = pp.length AND p.span = pp.span

MySQL said: Documentation
#1109 - Unknown table 'bays_jun18' in MULTI DELETE
 
never mind, this worked:

delete a . *
FROM bays_jun18 a
WHERE NOT
EXISTS (

SELECT *
FROM loadup2 b
WHERE b.type = a.type
AND b.span = a.span
AND b.length = a.length
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top