a guest Jan 22nd, 2020 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- select if(month(date)=12,"Декабрь",if(month(date)=1,"Январь","Што")) month, brand, art_num from (
- select o.id, date(date_create) date, pa.id pa_id, br.NAME_BRANDS brand, pa.art_num
- from orders o
- LEFT JOIN order_cars oc on o.id=oc.order_id
- LEFT JOIN order_product op on oc.id=op.car_id
- LEFT JOIN prices_all pa on op.price_all_id=pa.id
- left join brand_all br on pa.brand_id = br.id
- where date_create >= "2019-12-01"
- and o.order_delivery_id = 3
- and oc.id is not null and op.car_id is not null
- ) a group by month, brand, art_num
RAW Paste Data