That's not a PIVOT, that's a transposition. You're not aggregating multiple rows into a single column. Since you would have multiple column headings with the same name (the CHCK_DATE values), you'll struggle to do this in T-SQL, if it can be done at all.
Pure row/column transposition can be done in Excel, maybe also in SSRS, but I wouldn't know how.
Understood. The fields you supplied in the example were enough, it's still a pure transposition, and it's really just a presentation issue. If you had hundreds of rows that would transpose to hundreds of columns, it will be very unwieldy to do this in SQL.
Also, what happens if APPR_CD has more than 1 distinct value? Do you generate another row? What if APPR_CD = 1840 has an entirely different date range, like months or years before? If there were dozens of APPR_CD values, each with small date spans but overall covering an entire year, this kind of transposition would lead to tons of empty cells, and would be confusing if dates are repeated as headers.
What you mentioned is true, there would be more than one distinct value on those fields and the query would pull in some rather large numbers. Might have to rethink this one. My main goal was to just put the date results as columns and have the data show under those (knowing the data results could get large). Everything I've searched for online kept pointing to Pivot. but from there I needed to go a step further because the dates could change each time it's run, that's where the 'dynamic' pivot came in, so I wouldn't have to keep manually entering the dates in a WHERE or Pivot statement.
Trying another example here to see if may work better?
So this query works and does bring in the results in the last table like I want to see them, with the dates as columns.
My main goal however is to not have to type in the dates in the IN statement in the Pivot part. Is there a method or code that would work for this?