Date Range Dynamic Column count in sqlserver

  • QP

    dear All

     

    Above format, I need sql server Query

     

  • So what have you tried so far, and where are you stuck?

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

  • In my requirements input parameter is

    Start date and end date.

     

     

    Based on count I want to create a date column. Based on this column I need a count.

     

  • Ok, what have you tried so far in the way of coding, to get to this goal?

    What have you looked at in terms of syntax that you believe will accomplish the goal, and what is it that is not working for you

  • I need Query for this output. Frankly, i am not good in PIVOT

  • Well have your looked at cross tabs as an alternative to pivot?

    Post your query and we can see where its going wrong.

     

    Just giving you the answer wont be good for you as you're only going to need to support it in your environment, so best to increase the knowledge by helping with what you have already done, rather than here's the query

  • If you want help with actual T-SQL, please take the time to post your data in a format which we can all consume (with CREATE TABLE DDL and INSERT ... VALUES statements reflecting the sample data you have posted)

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • That's an awful lot of points for someone who can't even post consumable data. I guess this is required reading then: Forum Etiquette: How to post data/code on a forum to get the best help

    After that, read this: Cross Tabs and Pivots, Part 1 – Converting Rows to Columns

    Once you apply Jeff's solution, it's really easy.

Viewing 8 posts - 1 through 7 (of 7 total)

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