123

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS

Q&A for administrators, end users, developers and designers for Craft CMS

CREATE TABLE #yt
([name] char(20), [key1] varchar(20), [value] varchar(20))
;
    
INSERT INTO #yt
    ([name], [key1], [value])
VALUES
    ('Ram', 'City', 'Bangalore'),
    ('Ram', 'Age', '25'),
    ('Ram', 'Title', 'SE'),
    ('Shyam', 'City', 'Delhi'),
    ('Shyam', 'Age', '23')
;


select *
from 
(
  select name, key1, value
  from #yt
) src
pivot
(
  max(key1)
  for key1 in (Age, Title, City)
) piv;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results