SQL query: Can't order by column called “order”?

后端 未结 7 1753
忘掉有多难
忘掉有多难 2021-01-14 03:27

I am pulling a column in an existing script into my template files, and everything is working great.

The only problem is, that this script has a column called

相关标签:
7条回答
  • 2021-01-14 04:24

    order is a keyword in SQL. So if you wish to use a keyword as a name, use backtick characters around it:

    SELECT * FROM categories WHERE hide = 0 ORDER BY `order`
    

    Try that :)

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