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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:02:50+00:00 2026-06-04T11:02:50+00:00

So, I once again seem to have an issue with MS Access being finicky,

  • 0

So, I once again seem to have an issue with MS Access being finicky, although it seems to also be an issue when trying similar queries in SSMS (SQL Server Management Studio).

I have a collection of tables, loosely defined as follows:

  1. table widget_mfg { id (int), name (nvarchar) }
  2. table widget { id (int), name (nvarchar), mfg_id (int) }
  3. table widget_component { id (int), name (nvarchar), widget_id (int), component_id }
  4. table component { id (int), name (nvarchar), … } — There are ~25 columns in this table

What I’d like to do is query the database and get a list of all components that a specific manufacturer uses. I’ve tried some of these queries:

SELECT c.*, wc.widget_id, w.mfg_id
FROM ((widget_component wc INNER JOIN widget w ON wc.widget_id = w.id)
INNER JOIN widget_manufacturer wm on w.mfg_id = wm.id)
INNER JOIN component c on c.id = wc.component_id
WHERE wm.id = 1

The previous example displays duplicates of any part that is contained in multiple widget_component lists for different widgets.

I’ve also tried doing:

SELECT DISTINCT c.id, c.name, wc.widget_id, w.mfg_id
FROM component c, widget_component wc, widget w, widget_manufacturer wm
WHERE wm.id=w.mfg_id AND wm.id = 1

This doesn’t display anything at all. I was reading about sub-queries, but I do not understand how they work or how they would apply to my current application.

Any assistance in this would be beneficial.

As an aside, I am not very good with either MS Access or SQL in general. I know the basics, but not a lot beyond that.

Edit:

I just tried this code, and it works to get all the component.id’s while limiting them to a single entry each. How do I go about using the results of this to get a list of all the rest of the component data (component.*) where the id’s from the first part are used to select this data?

SELECT DISTINCT c.part_no
FROM component c, widget w, widget_component wc, widget_manufacturer wm
WHERE(((c.id=wc.component_id AND wc.widget_id=w.id AND w.mfg_id=wm.id AND wm.id=1)))

(P.S. this is probably not the best way to do this, but I am still learning SQL.)

  • 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-04T11:02:52+00:00Added an answer on June 4, 2026 at 11:02 am

    What I’d like to do is query the database and get a list of all
    components that a specific manufacturer uses

    There are several ways to do this. IN is probably the easiest to write

    SELECT c.* 
    FROM   component c 
    WHERE  c.id IN (SELECT c.component_id 
                    FROM   widget w 
                           INNER JOIN widget_component c 
                             ON w.id = c.widget_id 
                    WHERE  w.mfg_id = 123) 
    

    The IN sub query finds all the component ids that a specific manufacturer uses. The outer query then selects any component.id that is that result. It doesn’t matter if its in there once or 1000 times it will only get the component record once.

    The other ways of doing this are using an EXISTS sub query or using a join to the query (but then you do need to de-dup it)

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

Sidebar

Related Questions

I cant seem to access my table. Once again I'm sure its something simple
Good day once again. I have a (seemingly) simple problem. I'm trying to display
Once again a question about the garbage collector in actionscript-3: If I have a
I have once again fleshed out Ruby, after two years of not touching it,
I have a strange issue with my code I can't seem to figure out.
Once again with the charset issues when talking to DB's :) I have two
Ok. I'm stuck once again and it seems that internet just ran out of
Once again I'm doing Java graphics (Graphics2D) but I noticed there is no Polygon.Double
Once again I find myself failing at some really simple task in C++. Sometimes
Once again I was in a design review, and encountered the claim that the

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.