Home Forums SQL Server 2008 SQL Server Newbies Coding Counts and Subtotals by day, location and grand totals in T-SQL RE: Coding Counts and Subtotals by day, location and grand totals in T-SQL

  • So just so that I don't go in the wrong direction is this something towards what you are looking for?

    SELECT CONVERT( CHAR(10), sosb_CarDetail_DateReleased, 101 ) AS [DateReleased]

    , Count( sosb_CarDetail_CarNumber ) AS TotalCarsByDate

    FROM #mytable

    GROUP BY CONVERT( CHAR(10), sosb_CarDetail_DateReleased, 101 )

    ORDER BY CONVERT( CHAR(10), sosb_CarDetail_DateReleased, 101 )

    The grouping by the Date converted to '11/11/2013' makes it easier.

    I guess if you need the data in a table you can create a table variable and populated it (section by section) with update statements.

    Let me know if this helps ~ we can apply the same logic to the other information you're looking to capture.