Closed zjfksj closed 3 months ago
queryWrapper.selectAll(QgTOrder.class)
.select("refundQuantity.quantity")
.leftJoin("(SELECT ip.order_id, sum( CASE WHEN ip.item_parent_status IN ( 4, 5, 9 ) THEN 1 ELSE 0 END ) AS quantity FROM qg_t_items_parent AS ip GROUP BY ip.order_id ) AS refundQuantity ON (t.id = refundQuantity.order_id)")
.orderByDesc("refundQuantity.quantity");实现了
当前使用版本(必填,否则不予处理)
3.6.3
该问题是如何引起的?(确定最新版也有问题再提!!!)
怎么实现left join 子查询 SELECT o.*, refundQuantity.quantity FROM qg_t_order as o left join (select ip.order_id, sum(case when ip.item_parent_status in (4,5,9) then 1 else 0 end) as quantity from qg_t_items_parent as ip group by ip.order_id) as refundQuantity on (o.id = refundQuantity.order_id)
重现步骤(如果有就写完整)
报错信息