这里出了什么问题?
select NULL as "LINK",
DISTINCT HARDWAREOVERZICHT_STATIC."TOPDESK_vestiging" as "LABEL",
count( ZAM_BUILDING) as "STORK7"
from HARDWAREOVERZICHT_STATIC
where Omgeving = 'STORK7'
and "TOPDESK_heeftattentie" = 0
group by HARDWAREOVERZICHT_STATIC."TOPDESK_vestiging",ZAM_BUILDING
order by HARDWAREOVERZICHT_STATIC."TOPDESK_vestiging" desc
答案 0 :(得分:0)
DISTINCT
是一个跟在SELECT
之后的关键字,适用于该子句中的所有列。但是,group by
:
select NULL as "LINK", s."TOPDESK_vestiging" as "LABEL",
count( ZAM_BUILDING) as "STORK7"
from HARDWAREOVERZICHT_STATIC s
where Omgeving = 'STORK7' and "TOPDESK_heeftattentie" = 0
group by s."TOPDESK_vestiging"
order by s."TOPDESK_vestiging" desc;
我从ZAM_BUILDING
删除了group by
。否则,count()
始终为0
或1
。我还添加了一个表别名。