I get this error
each group by expression must contain at least one column that is not an outer reference
I am inserting date into a temp table, and error is at the following group by query(only on some collation)
insert into @Temp(Name, ID)
select
USR.Name,
ISNULL((SELECT SUM(BCR.QUANTITY)
FROM Rate BCR
WHERE BCR.RateID = USR.RateID
GROUP BY USR.RateID), 0) AS TotalQuantity
from
dbo.User as USR
where
USR.Status = 1