Hi all,
I have a query called [Scan Data MAT Comparison Report] and I want to rank each customer grouped on the field [Banner] and then by descending order on [Current MAT].
I have found many solutions where I can use a subquery to do this eg:
SELECT (SELECT COUNT(*) + 1
FROM [Scan Data MAT Comparison Report] AS C
WHERE (C.Banner = CS.Banner AND C.[Current MAT] > CS.[Current MAT])) AS RankInBanner, CS.[Cust Id], CS.Banner, CS.[Current MAT]
FROM [Scan Data MAT Comparison Report] AS CS
ORDER BY CS.Banner, CS.[Current MAT] DESC;
but every time I do this I get the "Query Too Complex" error. I have tried adding and removing [] to fields and tables with no joy.
Does anyone know what SQL I should use to eliminate this error?
Thanks,
janie