Unmatched query wizard??

G

geeves1293

I have succesfully made a Unmatched query using the wiz.

I changed the query to a delete query, but when I run it, it asks me which
table do i want to delete the records from.

I keep screaming at it 'what do you mean which table isn't it obvious', but
that doesn't work.

Can anyone tell me how to overcome this please.

Regards

Geeves1293
 
A

Allen Browne

Use a subquery to select the unmatched records

This example deletes records in tblInvoice that have no matching records in
tblInvoiceDetail:

DELETE FROM tblInvoice
WHERE NOT EXISTS
(SELECT InvoiceID
FROM tblInvoiceDetail
WHERE tblInvoiceDetail.InvoiceID = tblInvoice.InvoiceID);

If subqueries are new, here's an introduction:
http://allenbrowne.com/subquery-01.html#NotThere
 
G

geeves1293

Thanks again. Just managed to sort it.

Stopped screaming at it now.

Geeves1293
 

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

Top