Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi can anyone help to get the desired output:My Actual table is:
Classification Train Station Industry Key Customer Descr RE XX 1Z 142085 CustomerARE XX 1P 142079 CustomerB
Desire output table should be:
Parent Child descrRE XX null RE XX null XX 1Z null XX 1P null 1Z 142085 customerA1P 142079 customerB
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2013-06-03 : 23:27:16
[code]select [Classification] as Parent, [Train] as Child, NULL as descr from [My Actual table]union allselect [Train] as Parent, [Station] as Child, NULL as descr from [My Actual table]union allselect [Station] as Parent, [Industry Key] as Child, [Customer Descr] as descr from [My Actual table][/code]KH[spoiler]Time is always against us[/spoiler]