Im having a bit of difficulty with one equation I can't seem to figure out or find on here. I am trying to do the following;
I have 2 tables, products and teamproducts. There foreign key is productid. I am trying to select the products from the products table that have not been registered to the teamproducts table. I am also using a teamcode that in teamproducts. An example below;
SELECT productname FROM products p, teamproducts tp WHERE teamcode = teamcode1 AND p.productid != tp.productid
Untested, but I think this should do the job.
SELECT products.productname FROM products LEFT JOIN teamproducts ON teamproducts.teamcode = 'teamcode1' AND teamproducts.productid = products.productid WHERE teamproducts.productid IS NULL;