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 7165227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:12:18+00:00 2026-05-28T14:12:18+00:00

I am relatively new to SQL Server so I hope you can help. Basically

  • 0

I am relatively new to SQL Server so I hope you can help.

Basically I have two tables of information. The first looks like:

  • table1 [ID, Name]
  • table2 [FKID, ID, Name]

I want to do a statement like:

SELECT table1.Name, table2.Name
FROM table1
LEFT JOIN table2 ON table2.FKID = table1.ID

This results in something like:

['Name 1a', 'Name 2a']
['Name 1b', NULL]
['Name 1c', NULL]

But what I want is to just select ONE column, that either being Name 1x or Name 2x if it wasn’t null (there was no key match on the left join).

I imagine the typical response will be to solve this using my programming language, but this is proving to be extremely difficult in Visual Web Developer using GridViews and all this nonsense, so what would be very helpful would be a database solution.

Thanks a lot!

  • 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-05-28T14:12:19+00:00Added an answer on May 28, 2026 at 2:12 pm
    SELECT coalesce(table1.Name, table2.Name) as YourName
    FROM table1 
    LEFT JOIN table2 ON 
    table2.FKID = table1.ID 
    

    COALESCE() will return the first NOT NULL value. Is this what you’re looking for?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to Nant, what i'd like to do is have a task
I'm using Microsoft SQL Server 2005, and am relatively new to SQL in general.
So I am a first time user here, and still relatively new to SQL.
I have a routine that will be creating individual tables (Sql Server 2008) to
I'm relatively new to J2ME and about to begin my first serious project. My
I'm relatively new to web application programming so I hope this question isn't too
I am relatively new to MySQL and PHP and I have been trying to
I am relatively new to django. I have defined my db schema and validated
I'm relatively new to NoSQL databases and I have to evaluate different NoSQL-Solutions for
Forgive me as I'm relatively new to SQL. But I'm trying to take modified

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.