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

<<  February 2018  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

View posts in large calendar

RecentComments

TextBox