您好,我有以下 SQL 查询
Select catalogid , numitems, allitems - numitems ignoreditems
from (
select i.catalogid,
sum(case when (ocardtype in ('PayPal','Sofort') OR
ocardtype in ('mastercard','visa') and
odate is not null) then numitems
else 0 end) numitems,
sum(numitems) allitems
from orders o
join oitems i on i.orderid=o.orderid
join products T1 on T1.catalogid = i.catalogid
group by i.catalogid
) X
在最后一个连接语句表产品包含 8 列并且它们没有显示在结果查询中,我只能看到列 catalogid、numitems 和ignoreitems,所以我做错了什么,如果我必须选择这些列才能让他们出现我怎么能用这种语法来做呢?