select DISTINCT t0.name 客户名,t1.partner_id 客户ID,
t2.name 品名 ,t6.material as 材质,t6.cust_spec as 规格,t2.price_unit 单价,t4.name 单位,
case....when...then....else...end用法
case t3.packing_type1 when '1' then '隔板' when '2' then '泡沫' else '' end 包装方式
from res_partner t0
LEFT JOIN sale_order t1 on t0.id=t1.partner_id
LEFT JOIN sale_order_line t2 on t2.order_id=t1.id
LEFT JOIN sale_origin_line t3 on t2.order_id=t3.order_id
LEFT JOIN product_uom t4 on t4.id=t2.product_uom
left join product_product t5 on t5.id=t2.product_id
left join product_template t6 on t6.id=t5.product_tmpl_id
where t1.partner_id is not null
and t0.name='保定韩冠军'
ORDER BY t0.name DESC
;