There were quite a few issues - so I reformatted the query:
Select Datum
, Wdomain
, lgstkproc
, Username
, Case When LGSTKPROC = 'NAVUL'
Then count(Unique username + '-' + palnumber)
End As nr_pal_per_user_navul
, Case When LGSTKPROC != 'NAVUL'
Then count(Unique username + '-' + palnumber)
End As nr_pal_per_user_veplaatst
From (Select username
, res
, restype
, wdomain
, lgstkproc
, locname
, endlocname
, palnumber
, TRUNC(SYSDATE - 1) As datum
From TransportStock$VW TS
Where TRUNC(timestamp) < TRUNC(sysdate) -1
And res Not Like '%CONVS%'
)
Group By
username
, Datum
, lgstkproc
, Wdomain
These are the changes I made:
, Case When LGSTKPROC = 'NAVUL'
**Then** count(Unique username **+** '-' **+** palnumber**)**
End **As** nr_pal_per_user_navul
Similar changes were made to the next CASE expression.