soozh
asked on
Query syntax
Hello,
Can someone explain the different between the two lines of code marked below in terms of the way the grouping is:
Can someone explain the different between the two lines of code marked below in terms of the way the grouping is:
with cte as (
select
-1 as kli_kliniknr,
max(m.MeasurementDate) as MeasurementDate,
SUM(NumberOfMeasurements) as NumberOfMeasurements,
SUM(NumberOfMen) as NumberOfMen,
SUM(NumberOfWomen) as NumberOfWomen,
-- What is the difference between these two rows?
avg( Q1 * NumberOfMeasurements / NumberOfMeasurements) as Q1,
sum( Q1 * NumberOfMeasurements) / sum(NumberOfMeasurements) as Q1x,
from [BPSD].[dbo].[MeasurementStatisticsPerUnit] m
group by m.MeasurementDate )
select * from cte ;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.