0

I have this table:

Value |   Name    
300   |   moshe                 
400   |   yoni   
500   |   niv

And i would like to convert it into this:

nameColumn: moshe yoni niv     
value:      300   400  500

The value is float type and name is nchar(20). anyone? thanks

neer
  • 4,031
  • 6
  • 20
  • 34

1 Answers1

1

Most databases have a PIVOT relational operator (link for SQL Server) to turn the unique values of a specified column from multiple rows into multiple column values in the output (cross-tab), effectively rotating a table.

Julian
  • 4,176
  • 19
  • 40
tale852150
  • 1,618
  • 3
  • 17
  • 23
  • @Julian - with all due respect, I have been told not to include links because they can 'break' and so I don't include them. Then I am told to include links. So, we need this resolved going forward -- links or no links? I'm not blaming you but it is confusing. Who can I address to resolve this issue? Also, I don't believe this question is specific to SQL Server and there are / were no tags stating such. All in all, it should not be down voted. – tale852150 Aug 04 '16 at 22:25
  • I just added the link as additional information; you were right to post a text-based answer which did not solely consist of a link. In general, links are fine but they should only be used as a reference, rather than being presented as the answer itself. See also [help center on editing](http://stackoverflow.com/help/editing). For what it's worth, I did not downvote your answer. – Julian Aug 04 '16 at 23:51
  • @Julian - ok, we are good. I apologize for assuming you down voted the answer. And thanks for the clarification on links. – tale852150 Aug 05 '16 at 02:20