SQL select NOT IN
Posted: Tue May 23, 2023 7:46 am
Hello
Need some help on this.
I'm trying to exclude certain categories when creating and exporting products to a csv file
For my life i am not getting this part to exclude the categories or am i going the wrong way?
Original code at categories WHERE NOT IN... was categories as subc,
Need some help on this.
I'm trying to exclude certain categories when creating and exporting products to a csv file
For my life i am not getting this part to exclude the categories or am i going the wrong way?
Code: Select all
$filelayout_sql = "SELECT
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_status as v_status,
p.products_price as v_products_price,
p.products_quantity as v_products_quantity,
p.products_weight as v_products_weight,
p.products_image as v_products_image,
$ep_additional_layout_product_select
p.manufacturers_id as v_manufacturers_id,
p.products_date_available as v_date_avail,
p.products_date_added as v_date_added,
p.products_tax_class_id as v_tax_class_id,
p.products_gtin as v_products_gtin,
subc.categories_id as v_categories_id,
p.vendors_id as v_supplier
FROM
products as p,
categories WHERE NOT IN (SELECT categories_id FROM categories WHERE categories_id = (64,103,146,157,159,160,163,165,166,167,168,169,170,171,172,173,174,182,205) as subc,
products_to_categories as ptoc
WHERE
p.products_id = ptoc.products_id AND
ptoc.categories_id = subc.categories_id
" . $sql_filter;