Delete entries in TableB that are not in TableA

  • Thread starter Thread starter kikeman
  • Start date Start date
K

kikeman

Hi,

I have two tables: TableA and TableB they both have a column called
"OrderNo" (same type and info, of course), I would like to delete those
entries in TableB that ARE NOT in TableA according to the "OrderNo".

"OrderNo" is the Primary Key in TableA, but it is allow to have duplicates
in TableB of "OrderNo"

It is to say, I would have in TableB "OrderNo" values only if they exist in
TableA, now I want to avoid to have "OrderNo" in TableB that does no exist in
TableA.

What would SQL command to do this?
I am using OleDB in C#.

Thanks,
Enrique.
 

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

Back
Top