1

有我计算提供者阶段付款的程序,第 6 阶段有 3 个提供者让我们调用A、B、C我想要计数 * 阶段付款但在第 6 阶段我不想要计数 B (id=101) 提供者付款,我写选择:

select phase , count(*) as countPhases
from  dbo.auth a
inner join dbo.providers p ON a.provider_id = p.serno 
where (date between @from_date and @to_date) and (provider_id <> 101 and phase <> 6 )
group by phase

但它不会过滤我想要的方式(provider_id <> 101 和阶段 <> 6),请帮助我

4

1 回答 1

1

试试这个

where (date between @from_date and @to_date)
      and (phase <> 6
           or (phase=6 and provider_id <> 101))
于 2013-09-16T07:45:13.567 回答