sql select statement giving column error

前端 未结 3 1472
眼角桃花
眼角桃花 2021-01-28 09:59

When i use

SELECT order_id from `order` where `order_id`=U687678601

i get error

ERROR 1054: Unknown Column \'U68767

3条回答
  •  醉梦人生
    2021-01-28 10:17

    Order is a reserverd keyword, you should use another name for your table. You could enclose the table name in quotes, like this:

    SELECT order_id from `order` where order_id=U687678601
    

    And as for the quoting of values, if the value is of type string, you should use quotes always. If the value is some numeric type, you don't have to, but it won't do any harm to enclose virtually everything.

提交回复
热议问题