Column ‘XXXX‘ in order clause is ambiguous

Column ‘create_time’ in order clause is ambiguous
Column ‘XXXX‘ in order clause is ambiguous_第1张图片

原因是我多表查询,这个列两个表都有,需要指定一下哪个表的。那么你可能在写连表查询的时候,没有写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>

你可能感兴趣的:(SpringBoot学习,MySQL)