G
Guest
I have the following query built in which I am trying to Rank a very simple
1st, 2nd, 3rd (1,2,3) for the records that the query has produced but for
some reason evry record is ranked 1. Can someone please review and let me
know where I am going wrong, what adjustments do I need to make in order to
produce three ranks for each OprName?
SELECT SKYLINE_QUERY_MT.OprID, SKYLINE_QUERY_MT.OprName,
SKYLINE_QUERY_MT.ID, SKYLINE_QUERY_MT.Deliv, (SELECT Count(*)
FROM SKYLINE_QUERY_MT AS X
WHERE X.ID = SKYLINE_QUERY_MT.ID
AND X.Deliv <= SKYLINE_QUERY_MT.Deliv
) AS rank
FROM SKYLINE_QUERY_MT
ORDER BY SKYLINE_QUERY_MT.OprName, SKYLINE_QUERY_MT.ID,
SKYLINE_QUERY_MT.Deliv;
1st, 2nd, 3rd (1,2,3) for the records that the query has produced but for
some reason evry record is ranked 1. Can someone please review and let me
know where I am going wrong, what adjustments do I need to make in order to
produce three ranks for each OprName?
SELECT SKYLINE_QUERY_MT.OprID, SKYLINE_QUERY_MT.OprName,
SKYLINE_QUERY_MT.ID, SKYLINE_QUERY_MT.Deliv, (SELECT Count(*)
FROM SKYLINE_QUERY_MT AS X
WHERE X.ID = SKYLINE_QUERY_MT.ID
AND X.Deliv <= SKYLINE_QUERY_MT.Deliv
) AS rank
FROM SKYLINE_QUERY_MT
ORDER BY SKYLINE_QUERY_MT.OprName, SKYLINE_QUERY_MT.ID,
SKYLINE_QUERY_MT.Deliv;