Posts

Showing posts from October, 2012

How to make pivot.

SELECT   propertyid AS PropertyID, [2] as 'Type2',[7]as 'Type7',[8] as 'Type8' FROM (SELECT prop.propertyid,prop.relationshiptypeid     FROM  vw_SpaceContactRelationship as prop         ) AS SourceTable PIVOT ( MAX(relationshiptypeid) FOR relationshiptypeid  IN ([2],[7],[8]) ) AS PivotTable RESULT OF THIS QUERY PropertyID          Type2    Type7    Type8 707312                  NULL     7             8 707313                  NULL     7         NULL 707329                  2             7...