• Hi

    Here's a couple of articles by Jeff Moden on the subject

    http://www.sqlservercentral.com/articles/T-SQL/63681/

    http://www.sqlservercentral.com/articles/Crosstab/65048/

    They should help