Wednesday, 11 September 2013

Need to select table data into distinct columns based on a date in a row

Need to select table data into distinct columns based on a date in a row

I am not sure what I need here, looks sort of like I could use a pivot but
I don't think it's that complicated and would like to avoid pivot if I can
as I haven't used it much (er, at all).
I have data like this:
ID score notes CreateDate
1661 9.2 8.0 on Sept 2010 7/22/2010
1661 7.6 11/4/2010
1661 7.9 6/10/2011
1661 8.3 9/28/2011
1661 7.9 1/20/2012
I want to organize all that data on to one row with the oldest date being
first and then use the next oldest date, then next oldest...until I use 4
or 5 dates. So the end result would look something like this:
ID score1 notes1 date1 score2 notes2 date2
score3 notes3 date3 score4 notes4 date4
1661 9.2 8.0 on Sept 2010 7/22/2010 7.6 blah 11/4/2010
7.9 blah2 6/10/2011 8.3 blah3 9/28/2011

No comments:

Post a Comment