前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Column ‘XXXX‘ in order clause is ambiguous

Column ‘XXXX‘ in order clause is ambiguous

作者头像
关忆北.
发布2021-12-07 16:27:15
7830
发布2021-12-07 16:27:15
举报
文章被收录于专栏:关忆北.关忆北.

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>
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-11-17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档