Top number of rows based on date range

Answered Top number of rows based on date range

  • Monday, February 11, 2013 11:15 PM
     
     

    I have a view 

    Calls

    I`m using the following

    Incident column will have the name and description of the incident occurred. My requirement is to find out top 10 incidents occured for a date range lets day weeklly.. How can accomplish this task .. Can someone help me ?

    Select Agentname,AgentID,Incident,Group,Dateopened,Dateclosed from vw_Calls


    FM

All Replies

  • Tuesday, February 12, 2013 4:55 AM
    Moderator
     
     Answered

    Top 10 by what criteria?

    select top (10) ... from vw_Calls

    where DateOpened betwee @WeekStart and @WeekEnd

    ORDER BY Incident 


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

  • Thursday, February 21, 2013 12:37 AM
    Moderator
     
     
    For quick assistance post DDL (CREATE TABLEs).  Thanks.

    Kalman Toth Database & OLAP Architect
    Paperback / Kindle: Pass SQL Exam 70-461 & Job Interview: Programming SQL Server 2012