Home Forums SQL Server 2008 T-SQL (SS2K8) Getting Total Count for each month based on the Start and End Date RE: Getting Total Count for each month based on the Start and End Date

  • SELECT CONVERT(VARCHAR(10), DATEADD(mm, DATEDIFF(mm, 0, FlightDate), 0), 102) AS FlightMonth,

    COUNT(PaxNum) AS TotalPassengersCount

    FROM FlightDetails

    GROUP BY DATEADD(mm, DATEDIFF(mm, 0, FlightDate), 0)

    ORDER BY DATEADD(mm, DATEDIFF(mm, 0, FlightDate), 0)

    another idea 🙂

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day