Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:33:02+00:00 2026-06-15T13:33:02+00:00

I am trying to achieve a list of rows based on a table using

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:33:03+00:00Added an answer on June 15, 2026 at 1:33 pm

    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 UNPIVOT the data:

    SELECT x.listColumn1,
      x.listColumn2
    FROM YourTable t
    CROSS APPLY 
    (
        VALUES
            (t.SName, t.SValue),
            (t.LName, t.LValue),
            (t.FName, t.FValue)
    ) x (listColumn1, listColumn2)
    where x.listColumn1 is not null
      and x.listColumn2 is not null
    

    See SQL Fiddle with Demo

    Result:

    | LISTCOLUMN1 | LISTCOLUMN2 |
    -----------------------------
    |       TextS |         1.1 |
    |       TextL |         2.2 |
    |       TextF |         3.3 |
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to achieve the following without LINQ: I have a list of
What I am trying to achieve is writing a task which will list all
I am trying to achieve something like this. The Expandable List consists of the
I am trying to achieve the following - from a list of questions each
what I am trying to achieve is to have a persistent list of undoable
What I'm trying to achieve, is to output a json list that contains a
I'm trying to achieve some kind of nested transaction behavior using NHibernate's transaction control
I'm trying to get achieve a drilldown list kind of functionality. The code runs
What I'm trying to achieve is a list of strings from multiple tables. I
I'm trying to generate a summary from a list of scores in SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.