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

<<  August 2018  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

RecentComments

TextBox