I have example table like this :
type value
-----------------------
Name | John
Gender | Male
Address | New City
Phone | 62813
etc... | etc...
I want to make query and show the data from row into column, and the expected result like this :
Name Gender Address Phone etc...
----------------------------------------------
John | Male | New City | 62813 | etc...
In this scenario etc... means there are more data in the table. Is there any solution to show the table from row into column with many data in the table?
You would need to use Pivoting to solve this type of Problem.
Lets create a small demo table T2 and proceed from it.
Now if this is the exact number then we can hard code column value of
typeand use it in our sql as shown below.But if there are lot of rows in your table and you want it to be dynamic then you can use dynamic query to handle such type of problems.
This will give you the desired result.