问题:"Expression #1 of ORDER BY clause is not in SELECT list, references column 'd.dept_no' which is not in SELECT list; this is incompatible with DISTINCT"
即添加distinct后报错
原因:在用分组函数或窗口函数时,order by后面的字段名要和select后的字段名保持一致
解决:比如本例中select后的一个字段名为de.dept,而order by后用的是d.dept,需要把d.dept改成de.dept
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)