I am working on this request and it makes me go blank.
I have a product table and a table with additional products. In short, I want to create a presentation with product data and the lowest (discount) price of offal. (Think of a shirt with several offal (colors / sizes), etc.)
Secondly, I want to use this query in VIEW, and this part annoys me.
Now I have a request:
SELECT m.* from product_items m join (select product_id, min(price_discount) md from product_items group by product_id) mm on m.product_id=mm.product_id and m.price_discount=md
This query works and I get good results. But now I want to create a view (vw_product_lowest). And then the error: ERROR 1349 (HY000): View SELECT contains a subquery in the FROM clause
Can someone help me convert this request to a compatible VIEW request? Thanks!
source share