Hello,
I am trying to rank subscribers calls based on minutes. I want the rank to be within the each subscriber not based on every call every call in the table. I used the following query and it seems to be ranking the entire table based on minutes. Any ideas???
SELECT C1.SUBSCRIBER, C1.CALL_TO_NUMBER, C1.PRICE_PLAN, C1.SumOfMinutes,
(SELECT COUNT (SumOfMinutes)
FROM [CALL SUM MINUTES] AS C2
WHERE C2.SumOfMinutes >= C1.SumOfMinutes
AND C2.CALL_TO_NUMBER = C1.CALL_TO_NUMBER
AND C2.SUBSCRIBER = C1.SUBSCRIBER
and c2.PRICE_PLAN = C1.PRICE_PLAN) as Rank
FROM [CALL SUM MINUTES] AS C1;
I am trying to rank subscribers calls based on minutes. I want the rank to be within the each subscriber not based on every call every call in the table. I used the following query and it seems to be ranking the entire table based on minutes. Any ideas???
SELECT C1.SUBSCRIBER, C1.CALL_TO_NUMBER, C1.PRICE_PLAN, C1.SumOfMinutes,
(SELECT COUNT (SumOfMinutes)
FROM [CALL SUM MINUTES] AS C2
WHERE C2.SumOfMinutes >= C1.SumOfMinutes
AND C2.CALL_TO_NUMBER = C1.CALL_TO_NUMBER
AND C2.SUBSCRIBER = C1.SUBSCRIBER
and c2.PRICE_PLAN = C1.PRICE_PLAN) as Rank
FROM [CALL SUM MINUTES] AS C1;