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-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Union issue 1
Error "The search key was not found in any record" 1
Union/Join issue 1
Union Query Problem 4
Union Query Issue 1
Combine 3 tables 0
Left Join 2
Runtime Error .Refresh 1

Top