• Would you mind sharing some sample data together with your expected result?

    Please see the first link in my signature on how to post sample data.

    There are several ways to do it, e.g. using dateadd() and datediff() to "normalize" your data on an hourly base.

    One comment regarding the AM/PM format:

    usually, date formatting should be done at the front end level. What's the reason for doing it at the database side?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]