Time series problem

I'm going to create an analysis report based on time range. The data is grouped by the hourly range. There're two problems that I'm facing.

1. How can I generate such result set so that it will give me 0 count instead of missing that column

2. How can I vary the start and end time which depends on another table

I believe this is quite hard to be complete within a single SQL. However, I would still want to try. The SQL server is the Express version. No analysis service is available.




Answer this question

Time series problem

  • tom stucki

    1. create a table that contains the hour and left join to yourtable

    2. take a look at dateadd() function

    If this does not answer your question, post your table structure, some sample data and the expected result


  • Time series problem