字段 报告号 试验号 收费状态 6109-09LB-001 0900002 已收 6109-09LB-001 0900001 null select case when if exists(select 1 from tb where 报告号 = t.报告号 and 收费状态 is null) then null else '已收' end,* from tb t
isnull(收费状态,'')
select * from tb where 报告号 not in (select distinct 报告号 from tb where 收费状态 != '已收')
select 报告号 from tb a where not exists(select 1 from tb where 报告号=a.报告号 and isnull(收费状态,'')<>'已收' )
select 报告号 from tb a where not exists(select 1 from tb where 报告号=a.报告号 and isnull(收费状态,'')<>'已收' )
select distinct 报告号 from tb a where not exists(select 1 from tb where 报告号=a.报告号 and isnull(收费状态,'')<>'已收' )
select * from table where 报告号 not in ( select 报告号 from table where 收费状态 is null)
6109-09LB-001 0900002 已收
6109-09LB-001 0900001 null
select case when if exists(select 1 from tb where 报告号 = t.报告号 and 收费状态 is null) then null else '已收' end,*
from tb t
isnull(收费状态,'')
where 报告号 not in (select distinct 报告号 from tb where 收费状态 != '已收')
select 报告号 from tb a where not exists(select 1 from tb where 报告号=a.报告号 and isnull(收费状态,'')<>'已收' )