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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:23:48+00:00 2026-06-10T16:23:48+00:00

This must be easier than I am making it, but I am going crazy

  • 0

This must be easier than I am making it, but I am going crazy here.
What I want to do is create a view from three tables, like such:

SELECT tableA.name, tableB.id, tableB.categoryID, tableC.categoryParentID
FROM tableB, tableA where tableA.id=tableB.id JOIN tableC on
tableC.categoryID = tableB.categoryID;

Simple enough. However, what I want to accomplish is that in the case where tableB.categoryID is NULL, I want tableC.categoryParentID to show up as a NULL value rather than as the categoryParentID value.

So far with my results I either can get the table to show all the rows where tableB.categoryID IS not NULL, and exclude the rows that have a null value for categoryID entirely – I don’t want to do this – OR I get some weird variation that includes every row for categoryParentID from tableC for every row from tableB – which gives me upwards of 3,000,000 rows, and is also incorrect.

If this is unclear, I can explain more.

Thanks in advance.

  • 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-10T16:23:50+00:00Added an answer on June 10, 2026 at 4:23 pm

    If I’m understanding you correctly, what you want is:

    SELECT tableA.name,
           tableB.id,
           tableB.categoryID,
           tableC.categoryParentID
      FROM tableA
      JOIN tableB
        ON tableB.id = tableA.id
      LEFT
     OUTER
      JOIN tableC
        ON tableC.categoryID = tableB.categoryID
    ;
    

    (See the “left outer join” section of the Wikipedia article on SQL joins.)

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

Sidebar

Related Questions

There must be an easier way or function to do this code here: #!/usr/bin/env
This must be a duplicate. But with so many NSPredicate questions out there, I
This must have an obvious solution, but I'm stumped. We are developing an application
This must be very simple. But I just can't seem to find the proper
This must be so simple, but I can't find it: How do you restore
This must be a stupid question, but nevertheless I find it curious: Say I
This must be really obvious, but how do I make a winsock listen to
This must be simple, but I can't seem to figure it out. I am
There must be an easier way... void TransferFrom(object obj) { foreach(PropertyInfo prop in this.GetType().GetProperties())
There must be an easier way to do this. I have search and search

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.