MySQL is not supporting single line comments here. What would be the reason?

后端 未结 2 1254
旧时难觅i
旧时难觅i 2021-01-12 14:14

Here is what I am getting when I use single line comment (using --):

ERROR 1064 (42000): You have an error in your SQL syntax

2条回答
  •  青春惊慌失措
    2021-01-12 14:50

    From MySQL documentation:

    From a “-- ” sequence to the end of the line. In MySQL, the “-- ” (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on).

    You need some space character after --, for example:

    mysql> select 1;-- test select
    

提交回复
热议问题