Column ‘XXXX‘ in order clause is ambiguous

Column ‘create_time’ in order clause is ambiguous
在这里插入图片描述

原因是我多表查询,这个列两个表都有,需要指定一下哪个表的。那么你可能在写连表查询的时候,没有写order by,所以,orm框架自动添加了order by create_time,又因为你连接的表中,有相同的字段create_time,SQL不知道按哪个排序而报错
所以,SQL需要改成这样:

    <select id="orderList" resultType="org.jeecg.modules.code.productorder.entity.SolutionsOrderDTO">
		
SELECT
	po.id,
	po.order_amount,
	po.order_status,
	po.order_time,
	ps.product_name,
	ps.product_main_picture_url,
	ps.first_classification,
	ps.secondary_classification,
	ps.city_area,
	ps.supplier_name
FROM
	product_order AS po
	LEFT JOIN product_solutions AS ps ON ps.id = po.product_id
	-- ${ew.customSqlSegment}MyBatis-Plus支持自定义SQL分页语句
	${ew.customSqlSegment}
	order by po.create_time
	</select>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值