TSQL - Pivot uniqueidentifier

;
with cntval
AS
(
SELECT code
, id = MIN(CAST(id AS BINARY(16)))
FROM [table]
where (code = 1 or code =2 )
GROUP BY code
)
SELECT
cast ( max(case con.code when 1 then id end) as uniqueidentifier)
, cast ( max(case con.code when 2 then id end) as uniqueidentifier)
FROM
cntval con

Add comment

biuquote
  • Comment
  • Preview
Loading

Sponsored by

Calendar

<<  May 2018  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

TextBox