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

How to upload app to macOS

1. Open Terminal Press Cmd (⌘) + Space , type Terminal , and hit Enter . 2. Navigate to Your Build Output Directory Your .app file is likel...