Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Change Row Value as Column Header

Author  Topic 

karthik82.vk
Starting Member

1 Post

Posted - 2014-12-22 : 00:00:50
Hi,

I have two tables namely lu_parameter and tbl_param_values. The lu_parameter table consists of param_id and parameter column containing id numbers for the parameter names.

The tbl_param_values table consists of values corresponding to the parameters with the param_id value as the column header.

I want to join these two tables so that in the result query instead of param_id value as column heading, I need to have the parameter value as the column heading.

I have attached the screenshot of the data for reference. I am not that much aware of sql queries. Can anyone please help me to achieve this?

[url]https://www.dropbox.com/s/464c4nc850di1pv/Parameter.png?dl=0[/url]

Thanks for your help..

sz1
Aged Yak Warrior

555 Posts

Posted - 2014-12-22 : 08:52:36
You mean just change the column header names?

Select
a.CLIID,
a.SDCID,
a.SiteID,
Parameter1 = a.P1,
Parameter2 = a.P2,
Parameter3 = a.P3,
Parameter4 = a.P4,
Parameter5 = a.P5,
Parameter6 = a.P6,
Parameter7 = a.P7

From

tbl_param_values a


We are the creators of our own reality!
Go to Top of Page
   

- Advertisement -