SQL syntax error near desc

后端 未结 1 616
天命终不由人
天命终不由人 2021-01-24 18:38

The error I get is:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to

1条回答
  •  闹比i
    闹比i (楼主)
    2021-01-24 18:54

    DESC is an SQL keyword used to specify direction in an ORDER BY clause. That's probably the problem. Try surrounding it in backticks like `Desc`.

    Also, try to be careful not to use keywords or SQL functions as field names in the future, it can lead to really difficult to debug errors.

    0 讨论(0)
提交回复
热议问题