create table TL (TD varchar(10),T1 varchar(10),T2 varchar(10))
insert TL select 'a b c','aa','aa'
insert TL select 'a b c','bb','bb'
insert TL select 'a b c','cc','cc'
select case when (select count(*) from Tl where Tl.TD=T.TD and (Tl.T1+Tl.T2)<=(T.T1+T.T2))=1 then TD else '' end ,T.T1,t.T2 from TL T
insert TL select 'a b c','aa','aa'
insert TL select 'a b c','bb','bb'
insert TL select 'a b c','cc','cc'
select case when (select count(*) from Tl where Tl.TD=T.TD and (Tl.T1+Tl.T2)<=(T.T1+T.T2))=1 then TD else '' end ,T.T1,t.T2 from TL T
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货