首页 新闻 赞助 找找看

mysql里面的if语句,到底哪里错了

0
[已解决问题] 解决于 2013-05-22 19:42

if (@num>0) THEN
insert into test VALUE(2);
ELSE
insert into test VALUE(3);
end IF;
END

拖鞋王子的主页 拖鞋王子 | 初学一级 | 园豆:37
提问于:2013-05-21 17:58
< >
分享
最佳答案
0

改成这样看看吧

if (@num>0) then
insert into test(列名) VALUE(2);
ELSE then
insert into test(列名) VALUE(3);

end if

这个语法有错误的,insert into table 后面要带列名的,另外 else少了一个then

奖励园豆:5
清晓zzz | 菜鸟二级 |园豆:227 | 2013-05-22 14:37

不对

拖鞋王子 | 园豆:37 (初学一级) | 2013-05-22 16:50

@拖鞋王子: 多了个end

清晓zzz | 园豆:227 (菜鸟二级) | 2013-05-22 17:19
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册