Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
908 B
1
Indexable
Never
SELECT 
    od.id,
        od.orderId,
        od.productId,
        od.name as name_product,
        od.note,
        od.qty,
        od.qtyFinal,
        od.normalPrice,
        od.promoPrice,
        od.finalPrice,
        p.barcode,
        p.uom,

       cp2.id AS idCategory,
        cp2.code as codeCategory,
        cp2.name as NameCategory,
        
        cp.code as codeSubCategory,
        cp.name as NameSubCategory
FROM
    waorderaja.order_detail od
        LEFT JOIN
    waorderaja.product p ON p.id = od.productId
    left join
    waorderaja.product_store ps ON ps.productId= od.productId
     left join
    waorderaja.product_category ON product_category.productId= ps.productId
    left join 
    waorderaja.category_product cp ON cp.id=product_category.categoryProductId
    left join 
    waorderaja.category_product cp2 ON cp2.id=cp.parentId
    where od.orderId="200" group by cp.id;