Delete Query Problem

M

Michelle

I have the following code....

DELETE inmtinfo.IN_INMNUM, inmtinfo.IN_NAME, inmtinfo.IN_RACE,
inmtinfo.IN_BLDING, inmtinfo.IN_SECTION, inmtinfo.IN_CELLDRM,
inmtinfo.IN_BEDNUM, inmtinfo1.IN_INMNUM
FROM inmtinfo LEFT JOIN inmtinfo1 ON inmtinfo.IN_INMNUM = inmtinfo1.IN_INMNUM
WHERE (((inmtinfo1.IN_INMNUM) Is Null));

What i want is to delete the datat in the inmtinfo table if the IN_INMNUM
field is null in the inmtinfo1 table.
 
M

MGFoster

Michelle said:
I have the following code....

DELETE inmtinfo.IN_INMNUM, inmtinfo.IN_NAME, inmtinfo.IN_RACE,
inmtinfo.IN_BLDING, inmtinfo.IN_SECTION, inmtinfo.IN_CELLDRM,
inmtinfo.IN_BEDNUM, inmtinfo1.IN_INMNUM
FROM inmtinfo LEFT JOIN inmtinfo1 ON inmtinfo.IN_INMNUM = inmtinfo1.IN_INMNUM
WHERE (((inmtinfo1.IN_INMNUM) Is Null));

What i want is to delete the datat in the inmtinfo table if the IN_INMNUM
field is null in the inmtinfo1 table.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try this:

DELETE *
FROM inmtinfo
WHERE IN_INMNUM NOT IN (SELECT IN_INMNUM FROM inmtinfo1)

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

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

iQA/AwUBRJGkIIechKqOuFEgEQLvegCeItJUKhqdLsdfy8Jl7zGn4creJlgAn3jS
iUneVBnrbShVuhKVJp4rWRt1
=GXnh
-----END PGP SIGNATURE-----
 
Top