Pages

Friday, July 25, 2008

RoWNum in MS Access

There were couple of questions in my mail-box that is how to produce RowNum in MS Access queries??

After spending couple of hours finally this can be achieved with Sub-queries...is this great?

SELECT o1.EMPID, o1.ENAME,
(SELECT COUNT(*) FROM Emp AS o2
WHERE o2.Sal <= o1.Sal) AS RowNum
FROM Emp AS o1
ORDER BY o1.Sal

Happy Coding....

3 comments:

Anonymous said...

very good information

nitya

ticktock said...

This worked great. For some reason this did not:
http://www.pcreview.co.uk/forums/thread-1164681.php

Although, in the end, I just resorted and reimported the data because 300k records was to much for this rownum query + subquery

Vijaya Kadiyala said...

It would be good if you could post your query :)..