declare @ctf char(18),@cdj7 char(6)
--这里假设 @ctf = '284-854'
set @ctf = '284-854'
begin
declare @cSQL varchar(1000)
if @cSQL = '上海' or @cSQL = '北京' or @cSQL = '天津'
begin
if exists(select * from address where tf = @ctf and (dj7 = '拆上海' or dj7 = '北京' or dj7 = '天津'))
select '1'
end
else if @cSQL = '合肥' or @cSQL = '杭州' or @cSQL = '昆山' or @cSQL = '苏州'
begin
if exists(select * from ddjl where tf = @ctf and (dj7 = '哈尔滨' or dj7 = '青岛'))
select '1'
end
else select '0'
end请问上面的语句还可以改进吗???
--这里假设 @ctf = '284-854'
set @ctf = '284-854'
begin
declare @cSQL varchar(1000)
if @cSQL = '上海' or @cSQL = '北京' or @cSQL = '天津'
begin
if exists(select * from address where tf = @ctf and (dj7 = '拆上海' or dj7 = '北京' or dj7 = '天津'))
select '1'
end
else if @cSQL = '合肥' or @cSQL = '杭州' or @cSQL = '昆山' or @cSQL = '苏州'
begin
if exists(select * from ddjl where tf = @ctf and (dj7 = '哈尔滨' or dj7 = '青岛'))
select '1'
end
else select '0'
end请问上面的语句还可以改进吗???
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货