[SOLVED] Problem with query
Posted: Tue Feb 21, 2006 2:37 am
I'm trying to pull out a list of products but exclude those already existing in another table. I have the following query:
Then a while loop to show the products. Without the sub query it works fine, just can't get the subquery to work. Any ideas?
Code: Select all
$list = "SELECT * FROM categories,products,form_products
WHERE products.category_id=categories.category_id AND products.category_id='$cat' AND products.$p_type='1'
AND products.product_id NOT IN (SELECT form_product FROM form_products WHERE form_id='$_POST[id]') ORDER BY products.product_id ASC";