• bquintana (2/18/2013)


    I need help in querying a table for volume by 30 minute interval by day month by month.

    Table dbo.HisT contained info in this format

    CallDateTime HistID

    2013-02-01 06:14:41.000 2671058

    2013-02-01 07:02:15.000 2671057

    2013-02-01 07:06:41.000 2671059

    2013-02-01 07:07:20.000 2671069

    2013-02-01 07:22:57.000 2671068

    2013-02-01 07:38:15.000 2671067

    2013-02-01 07:42:48.000 2671066

    2013-02-01 07:53:47.000 2671065

    2013-02-01 08:02:37.000 2671064

    2013-02-01 08:07:04.000 2671063

    2013-02-01 08:11:09.000 2671062

    2013-02-01 08:22:12.000 2671061

    2013-02-01 08:22:48.000 2671060

    Results should show something like this

    06:00-06:30 1

    06:30-07:00 0

    07:00-07:30 4

    07:30-08:00 3

    08:00-08:30 5

    Thank you for any insight

    What do you want to show when the date changes? And, how much of the day do you want to show? All 24 hours or ???

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)