在我添加c.category <> 'AGILE'
到下面的查询后,结果集停止NULL
包含c.category
. 如何NULL
在我的结果集中获取带有 c.category 的行,而不执行UNION
?
select
p.number,
p.method
,sum(p.amount) AS amount
,count(*) AS count,c.category
from payments p
inner join headers a
on p.name = a.name
inner join customer c
on c.number = p.number
and a.status = 'APPROVED'
and a.type IN ('REGULAR', 'TRANSFER', 'OTHER')
and c.category <> 'AGILE'
group by
p.payment_method
,p.cust_number
,c.u_cust_category