您的位置:首页 > 数据库 > Oracle

Oracle:Ora-01791 不是Selected表达式

2016-03-28 11:14 429 查看
SELECT DISTINCT a.id from portal_site_part p  left join portal_eai_app a on a.ID=p.BUSINESS_ID where p.id in(1003,1005) ORDER by a.PRIORITY ASC;

原来是order by 后排序的字段没有出现在distinct中,在distinct 后加上a.PRIORITY就可以了,如下所示:

SELECT DISTINCT a.id,a.PRIORITY from portal_site_part p  left join portal_eai_app a on a.ID=p.BUSINESS_ID where p.id in(1003,1005) ORDER by a.PRIORITY ASC;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: