I have a mysql select statement which I ran directly in phpmyadmin. It works find. How do I write the mysql statement for this in cakephp 3. I appreciate the help.
The logic is this: table product_categories has product_id and category_id linking both the category table and the product table. Table product_options has product_id, size, color, qty. I am trying to display products based on a category, but I want to display only those with color RED.
select *from product_options, (select * FROM products Products
left JOIN product_categories pc ON Products.id = pc.product_id
WHERE pc.category_id = 74) as ptotals
left join product_options po ON ptotals.id = po.product_id
where po.color = 'RED'