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

  • Home
  • SEARCH
  • 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 171377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:58:38+00:00 2026-05-11T12:58:38+00:00

I have two database tables, Categories and SuperCategories, for an inventory control system I’m

  • 0

I have two database tables, Categories and SuperCategories, for an inventory control system I’m working on:

Categories: ID_Category, CategoryName

SuperCategories: ID_SuperCategory, CategoryID, SuperCategoryID

I’m putting category-subcategory relationships into the SuperCategories table. I’m putting all categories into the Categories table.

Here is an example:

     Categories:     ID_Category CategoryName     1           Box     2           Red Box     3           Blue Box     4           Blue Plastic Box     5           Can     6           Tin Can   
         SuperCategories:     ID_Super CategoryID SuperCategoryID     1        2          1     2        3          1     3        4          3     4        6          5 

CategoryID and SuperCategoryID relate back to the primary key ID_Category in the Categories table.

What I would like is a query that returns all of the category names that are not parents of any other categories:

Red Box
Blue Plastic Box
Tin Can

This amounts to finding all values of ID_Category that do not show up in the SuperCategoryID column (2, 4, and 6), but I’m having trouble writing the SQL.

I’m using VB6 to query an Access 2000 database.

Any help is appreciated. Thanks!

EDIT: I voted up everyone’s answer that gave me something that worked. I accepted the answer that I felt was the most instructive. Thanks again for your help!

  • 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. 2026-05-11T12:58:38+00:00Added an answer on May 11, 2026 at 12:58 pm

    Mike Pone’s answer works, because he joins the ‘Categories’ table with the ‘SuperCategories’ table as a ‘LEFT OUTER JOIN’ – this will take all entries from ‘Categories’ and add columns from ‘SuperCategories’ to those where the link exists – where it does not exist (e.g. where there is no entry in ‘SuperCategories’), you’ll get NULLs for the SuperCategories columns – and that’s exactly what Mike’s query then checks for.

    If you would write the query like so:

    SELECT c.CategoryName, s.ID_Super  FROM Categories c  LEFT OUTER JOIN SuperCategories s ON c.ID_Category = s.SuperCategoryID 

    you would get something like this:

    CategoryName    ID_Super Box               1 Box               2 Red Box           NULL Blue Box          3 Blue Plastic Box  NULL Can               4 Tin Can           NULL 

    So this basically gives you your answer – all the rows where the ID_Super on the LEFT OUTER JOIN is NULL are those who don’t have any entries in the SuperCategories table. All clear? 🙂

    Marc

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

Sidebar

Ask A Question

Stats

  • Questions 190k
  • Answers 190k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Typically, you would do this by splitting up the work… May 12, 2026 at 5:58 pm
  • Editorial Team
    Editorial Team added an answer Obsolete notice: This answer refers to an extremely old version… May 12, 2026 at 5:58 pm
  • Editorial Team
    Editorial Team added an answer You have to go to the project properties (right button… May 12, 2026 at 5:58 pm

Related Questions

I have two database tables, Categories and SuperCategories, for an inventory control system I'm
I have two tables (item and category, I think they speak for themselves) and
I currently have a database with two tables called Articles and Tags . In
I have been programming in C# and Java for a little over a year
I believe that I am having a bad database design and need some help

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.