日期:2014-05-16  浏览次数:20767 次

mssql与mysql区别之二:判断条件语句区别

mssql:

declare @n varchar(100)
set @n = 'aaa'
select @n = xx.name from xx order by xx.id desc
print '最后一个是:'+@n
if(@n='a')
begin
print '正解'
end
else
begin
print '费解'
end
go

?

mysql:

create PROCEDURE p1()
begin
select @n:=max(total) FROM `month`;
IF @n=1 THEN
select 'no';
ELSE
select @n;
END IF;
end;
?