Pegar produtos categoria e subcategorias
Oi galera tudo bem?
eu tenho as seguintes tabelas:
CREATE TABLE categories ( id INT(11) NOT NULL AUTO_INCREMENT, category_name VARCHAR(45) NULL, category_order INT(11) NULL, category_father INT(11) NULL, category_status ENUM('s', 'n') NULL, category_created_at DATETIME NULL, category_modified_in DATETIME NULL, PRIMARY KEY(id));CREATE TABLE products ( id INT(11) NOT NULL AUTO_INCREMENT, category_id INT(11) NOT NULL, product_name VARCHAR(255) NULL, product_description LONGTEXT NULL, product_price DOUBLE(10,2) NULL, product_frete_free ENUM('s', 'n') NULL, product_stock NUMERIC NULL, product_status ENUM('s', 'n') NULL, product_created_at DATETIME NULL, product_modified_in DATETIME NULL, PRIMARY KEY(id), INDEX products_FKIndex1(category_id));
Eu gostaria de fazer um select que quando eu mandasse pegar os produtos de uma categoria pegasse também os das subcategrias.
Minha dúvida é como posso fazer isso.
Discussão (4)
Carregando comentários...