Chinaunix

标题: mysql 流程控制函数哪里出错了? [打印本页]

作者: xinn1983    时间: 2015-11-09 16:54
标题: mysql 流程控制函数哪里出错了?
use test1
go
if rls in(select name from teacher where age=22)
print  as '任老师年龄22岁'
ELSE
print  as '任老师年龄不是22岁'
提示错误如下:

[Err] 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 'go
if rls in(select name from teacher where age=22)
print  as '任老师年' at line 2

作者: xinn1983    时间: 2015-11-10 09:16
怎么没人回复啊。郁闷!
作者: xinn1983    时间: 2015-11-10 09:29
use test1
go
if rls in(select name from teacher where age=22)
print  as '任老师年龄22岁'
ELSE
print  as '任老师年龄不是22岁'
提示错误如下:

[Err] 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 'go
if rls in(select name from teacher where age=22)
print  as '任老师年' at line 2
各位帮忙看看呗谢谢了
作者: douyaqiang123    时间: 2015-11-13 13:28

use test1
go
if EXISTS (select 1 from teacher where age=22 and name='rls')
print  as '任老师年龄22岁'
ELSE
print  as '任老师年龄不是22岁'




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2