123

0

Please login or register to vote for this query.

(click on this box to dismiss)

Cognitive Sciences Meta

Q&A about the site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry

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 age,city,title
from 
(
  select name, key1, value
  from #yt
) src
pivot
(
  max(value)
  for key1 in (Age, City, Title)
) piv;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results