Query output should be

  • We have database called store, I have an issue to generate the hourly count report dynamically.

    Whenever I execute the below query and I get the output as below

    Date_TimeMsgCount

    2009-08-06 022452

    2009-08-06 022210

    2009-08-06 034173

    2009-08-06 046450

    2009-08-06 055452

    2009-08-06 062452

    2009-08-06 072462

    2009-08-06 104521

    But I need the output should be

    Date_TimeMsgCount

    2009-08-06 022452

    2009-08-06 022210

    2009-08-06 034173

    2009-08-06 046450

    2009-08-06 055452

    2009-08-06 062452

    2009-08-06 072462

    2009-08-06 080

    2009-08-06 090

    2009-08-06 104521

    I am using the query to generate the report as below,

    select convert(varchar(13), lastupdated, 120) As Date_Time, count(*) As MsgCount from store_details(nolock)

    group by convert(varchar(13), lastupdated, 120)

    order by convert(varchar(13), lastupdated, 120)

    Please help me how will I get the output.

    Thanks in Advance


    Kindest Regards,

    karthik

  • Duplicate post... no responses here please. Goto http://www.sqlservercentral.com/Forums/Topic765935-8-1.aspx

    --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)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply