Folks (off-topic) a colleague of mine has a 20000 row csv file with some columns of questionnaire data. He asked me to use T-SQL PIVOT to make a simple crosstab, but I can't figure out the syntax. Is there a PIVOT boffin here who could get me started with a working sample?
The raw data looks like the following. I used the import wizard to make a table (make the default columns wider!!). The first query I failed to compose was on Q1 (age range) and Q2 (sex), which was a simple crosstab of counts (or percentage) of Male/Female in each age range. [image: image.png] I've put a zip of the raw data here: https://orthoprog.blob.core.windows.net/download/Combo_01.zip Cheers, *Greg Keogh* P.S. Contact me off-list via gfke...@gmail.com