Delete Query

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

I have two tables and i want to delete out of table 1 all the records where
the same item appears in table 2

Here is what I have but it wont let me delete the records.

DELETE tblStructures.*
FROM tblStructures INNER JOIN tblRoutings ON tblStructures.Component =
tblRoutings.Workcentre;

What am I doing wrong?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Perhaps this:

DELETE DISTINCTROW tblStructures.*
FROM tblStructures INNER JOIN tblRoutings ON tblStructures.Component =
tblRoutings.Workcentre;

Or this:

DELETE *
FROM tblStructures
WHERE Component In (SELECT Workcentre FROM tblRoutings)

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQYkgCIechKqOuFEgEQIVKQCgsTrtLPPa/qM5P3Mi8bj8qotuU+QAnion
BWuyeNbukQWKZflnRQtpbLu2
=ITdP
-----END PGP SIGNATURE-----
 
hi,
I think you need a where clause referencing table you want
the records deleted form
WHERE Table1.field1 is not null;
 
Back
Top