我在遵循MySQL指南IF
語法時遇到語法錯誤。IF語法錯誤
我的查詢是:
if 0=0 then select 'hello world'; end if;
從邏輯上講,這應該選擇'hello world'
,而是我得到
ERROR 1064 (42000): 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 'if (0=0) then select 'hello world'' at line 1
ERROR 1064 (42000): 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 'end if' at line 1
爲什麼不直接使用內置的IF()函數? – spiderman
是的,這是可能的,但我已經根據問題的背景回答了,因爲我知道了! – geeksal