Link to home
Start Free TrialLog in
Avatar of TG-Steve
TG-Steve

asked on

Query to remove lines from 1 table by referencing another table

hi guys

I  have 2 tables referenced within a Mysql Database
 
Table 1 has arround 3000 lines of data and Table 2 has 1300 lines of data. both tables have different fields but both have a field named "product" which is a numeric number.

I am after some how querying the table with 1300 lines which has a field named product. And instructing Table 1 to delete any lines that DO NOT reference those that are within Table 2. Hereby me having 2 tables with 1300 lines.

The reason behind this is that Table 1 is a product table that has an entire product database but 1700 of them are old and not used. Table 2 has the stock control for the products and i only want to show the stock that has products on a website instead of people seeing products which are out of stock

Thank you in advance
ASKER CERTIFIED SOLUTION
Avatar of AriMc
AriMc
Flag of Finland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TG-Steve
TG-Steve

ASKER

worked like a charm thank you