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.
| Author |
Topic |
|
rangeshram
Starting Member
1 Post |
Posted - 2011-11-07 : 02:02:05
|
| Dear All,I am newly registered user and also fresh to SQL Programming. We will happy if you provide any help/suggest for the below scenario.We need to select the particular column in tblBenchmark where the column was available in tblProjectDetailsWe have complexity levels based on the particular projecttblBenchmark ProjectID Low Medium High1 50 40 302 60 40 20tblProjectDetailsProjectID ProjectName Complexity1 Pipeline Low2 Standard MediumFrom the above we need to get the result as below:ProjectName Complexity ValuePipeline Low 50Standard Medium 40Hope this clarifies. Let me know if you need any more details.Thanks, |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-07 : 03:56:56
|
| [code]SELECT pd.ProjectName,pd.Complexity,m.[Value]FROM(SELECT ProjectID,Complexity,[Value]FROM tblBenchmark bUNPIVOT([Value] FOR [Complexity] IN ([Low],[Medium],[High]))u)mINNER JOIN tblProjectDetails pdON pd.Project_ID = m.Project_IDAND pd.Complexity = m.Complexity[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|