I have a select statement which is intended to output rows ranked by totalsales for a given area which goes like this:
SELECT A.name, A.district, A.month, A.year, A.totalsales,
(SELECT COUNT(DISTINCT totalsales)
FROM mreport B
WHERE B.year = 2003
AND B.month = 1...