I am trying to achieve a list of rows based on a table using SQL and LINQ.
The available table is as followed:
ID SName SValue LName LValue FName FValue
1 TextS 1.1 null null null null
2 null null TextL 2.2 null null
3 null null null null TextF 3.3
I am trying write a query which can result a list like this:
listColumn1 listColumn2
TextS 1.1
TextL 2.2
TextF 3.3
Please help with your expert advice.
Thank you.
You did not specify what RDBMS you are using but if you are using SQL Server 2008+ and you want to perform this in SQL and then use the result you can
UNPIVOTthe data:See SQL Fiddle with Demo
Result: