Date Range Dynamic Column count in sqlserver

  • vs.satheesh

    SSCrazy

    Points: 2221

    QP

    dear All

     

    Above format, I need sql server Query

     

  • jonathan.crawford

    SSCertifiable

    Points: 6408

    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

  • vs.satheesh

    SSCrazy

    Points: 2221

    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.

     

  • anthony.green

    SSC Guru

    Points: 112358

    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

  • vs.satheesh

    SSCrazy

    Points: 2221

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

  • anthony.green

    SSC Guru

    Points: 112358

    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

  • Phil Parkin

    SSC Guru

    Points: 243998

    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 the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

  • pietlinden

    SSC Guru

    Points: 62674

    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 8 (of 8 total)

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