回答

收藏

简单的IF ..其他..mysql查询

技术问答 技术问答 156 人阅读 | 0 人回复 | 2023-09-12

set @var=1;if @var>1 then select * from client;elseselect * from otherTable;end if;这是我的mysql查询。你能指出为什么会出错吗?这真的让我筋疲力尽。# Q0 w& A8 E* n2 r9 R+ I
显示的错误是
) A' y# a% Q4 p8 _7 V% \' ^, P  G0 R, z/ NIF @var >1 THEN SELECT *FROM client;MySQL said: Documentation#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 'if @var>1 thenselect * from client' at line 1快速回答会很有帮助。  ^1 x* }1 `+ Y. p
                                                               
! z! f- B2 x& Z/ x! |! y    解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则