mysql 5.7Expression #1 of ORDER BY clause is not in SELECT list

 

java.sql.SQLException: Expression #1 of ORDER BY clause is not in SELECT list, references column 'amc.ti.create_time' which is not in SELECT list; this is incompatible with DISTINCT

 

  I encountered a problem today, a sql can run in mysql5.6, but not in mysql5.7. Baidu said that my.cnf can be modified, but mysql of mac does not have this configuration. continue to Baidu,

http://bbs.csdn.net/topics/391878172page=1,

 http://blog.sina.com.cn/s/blog_4f925fc30102e0ot.html

 

Correct spelling of the above sentence: SELECT T.NAME FROM UNIT T WHERE ROWNUM < 10  ORDER BY  T.UNITNO;

                  or                 

                  SELECT DISTINCT T.NAME,T.UNITNO FROM UNIT T WHERE ROWNUM < 10 ORDER BYT.UNITNO;

 

[Note]: After adding DISTINCT , the data is first put into a temporary collection after DISTINCT and then sorted.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326227046&siteId=291194637