Wednesday, July 20, 2011

SQL SERVER- SQL Statement to perform PIVOT functionality in SQL 2000

PIVOT and UNPIVOT are built in functions in SQL 2005 but in sql2000 we can use case statement with group by clause to Achieve same thing
Example:

SELECT

Name,

MAX(CASE WHEN Title = 'Visit 1' then DateResult else null END) AS 'Visit1',

MAX(CASE WHEN Title = 'Visit 2' then DateResult else null END) AS 'Visit2'

FROM PersonSchedule

group

by Name

No comments:

Post a Comment

If you’re using Visual Studio to build your .NET MAUI app on a Mac, locating the IPA (iOS App Package) file can be a bit tricky

  If you’re using   Visual Studio   to build your   .NET MAUI   app on a   Mac , locating the   IPA (iOS App Package)   file can be a bit tr...