Experts,
How to get sum between these two values ?
SELECT
[Soldtopt],
[tradingname],
[DlvDate],
SUM(try_cast(Netvalue as float)) as Netvalue,
count(distinct SDDoc) as Salesdoc ,
count(distinct case when Netvalue = '0' then 1 else null end) as ZeroValue ,
sum (count(distinct SDDoc)) , (count(distinct case when Netvalue = '0' then 1 else null end)) As result
FROM [FOC].[dbo].[foc]
GROUP by Soldtopt,tradingname,DlvDate ORDER BY count (distinct SDDoc) DESC;
is this correct to way to bring the sum(
sum (count(distinct SDDoc)) , (count(distinct case when Netvalue = '0' then 1 else null end)) As result)
? or i am getting error "
Msg 130, Level 15, State 1, Line 13
Cannot perform an aggregate function on an expression containing an aggregate or a subquery."