Delete data from table that was in another one.

  • Thread starter Thread starter eclypz
  • Start date Start date
E

eclypz

Hi,

My problem is this:

I Have two tables... one active products, and another one with active
and non active products (global products).
those tables has a primary key, that is the code of produt.

what i want is to delete from Global Products, all the data that are in
the active products, so that i can create another table with just non
active products.

Any help will be helpfull.

thanx so much.
 
Hi there

Try this query:

DELETE FROM Table1
WHERE ID In (SELECT ID FROM Table2 WHERE IsActive = false);

Before you run the query, you might want to do a backup of you table or
database.

Lucas
 

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