我運行此查詢:錯誤在MySQL查詢
select sm.stockid as 'id',description as 'descripcion',price as 'precio'
from stockmaster as 'sm', prices as 'pc'
where
sm.stockid=pc.stockid and
sm.stockid='ESPOLVOREO' and
curdate() between pc.startdate and pc.enddate;
,我不斷收到這個錯誤,我沒有權原因:/
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''sm', prices as 'pc' where sm.stockid=pc.stockid and sm.stockid='ESPOLVOREO' a' at line 2
我直接運行查詢在分貝。 謝謝
誰說別名不能用引號引起來? :)關閉。手冊https://dev.mysql.com/doc/refman/4.1/en/identifiers.html我失蹤了什麼? – user1954544
別名不能用單引號括起來。通常的引用字符是反引號。您可以使用雙引號,但前提是您已啓用ANSI_QUOTES。 – Joni
'SELECT 1 AS 1,2 AS'two';'從官方手冊中,我認爲它默認啓用。 (更改關於單引號的答案) – user1954544