| | |
| | | group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as salesContractNo, |
| | | group_concat(distinct sl2.customer_name order by sl2.customer_name separator ',') as customerName |
| | | from production_order po2 |
| | | left join production_plan pp2 |
| | | on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0 |
| | | join json_table(po2.production_plan_ids, '$[*]' columns(plan_id bigint path '$')) jt |
| | | join production_plan pp2 on pp2.id = jt.plan_id |
| | | left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id |
| | | group by po2.id |
| | | ) po_sales on po_sales.orderId = po.id |