Question

Asked:
Asked By:
Feb 14 2008   4:18 PM GMT
Win   5 pts.

TEN BUSY DAYS OF THE MONTH BASED ON THE TRAFFIC


Development, RANK

I WANT TO WRITE A SCRIPT FOR THE TEN BUSIEST DAYS OF THE MONTH BASED ON TRAFFIC.HOW DO I GO ABT IT?

THE SCRIPT BELOW IS FOR THE TEN BUSIEST SITES IN THE MONTH,CAN YOU HELP WITH THAT?

SELECT DATETIME,SITE,TCH_TRAFFIC,RANK
FROM
(
SELECT TRUNC(DATETIME,'MM')DATETIME


,SITE
,SUM(SDCCH_CALL_DROP) SDCCH_CALL_DROP
,SUM(TCH_DROP) TCH_DROP
,ROUND(SUM(TCH_TRAFF),2)TCH_TRAFFIC
,ROW_NUMBER() OVER(PARTITION BY TRUNC(DATETIME,'MM') ORDER BY ROUND(SUM(TCH_TRAFF),2) DESC NULLS LAST) RANK

FROM ZTE_BSS.V_STD_CELLSTATS_DY --,ZTE_BSS.CELLCFG B
WHERE DATETIME BETWEEN TRUNC(SYSDATE,'MM')-3 AND TRUNC(SYSDATE,'MM')-2
--GROUP BY TRUNC(DATETIME,'DD'),CELL--DATETIME,CELL
GROUP BY TRUNC(DATETIME,'MM'),SITE
)
WHERE RANK <=10

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Use the same script, change the TRUNC(DATETIME, 'MM') to TRUNC(DATETIME, 'DD') and remove the SITE column from the SELECT and the GROUP BY.

Don't forget the TRUNC function within the ROW_NUMBER command.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development.

Looking for relevant Development Whitepapers? Visit the SearchWinDevelopment.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register