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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:01:37+00:00 2026-06-03T13:01:37+00:00

I am using 3 tables for this, Part, PartDrawing and ShopDrawing. Basically I want

  • 0

I am using 3 tables for this, Part, PartDrawing and ShopDrawing. Basically I want to display all ShopDrawings where all their Parts are in stock. However each ShopDrawing has multiple PartDrawings that go with it so when I run my query like this:

SELECT DISTINCT ShopDrawing.DrawingNo FROM ShopDrawing, PartDrawing, Part
WHERE ShopDrawing.DrawingNo = PartDrawing.DrawingNo
AND PartDrawing.PartNo = Part.PartNo
AND Part.InStock = 'YES';

It displays every single ShopDrawing because they all have at least one Part that is in stock. I only want want it to display the ShopDrawings where all the Parts that are needed for it are in stock, and I’m not sure how to do this.

  • 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-03T13:01:40+00:00Added an answer on June 3, 2026 at 1:01 pm

    Try to evaluate by not select data with Part.InStock = 'NO' rather than select data with Part.InStock = 'YES'

    SELECT 
         ShopDrawing.DrawingNo 
    FROM 
         ShopDrawing WHERE ShopDrawing.DrawingNo NOT IN
             (SELECT 
                  PartDrawing.DrawingNo 
              FROM 
                  PartDrawing LEFT JOIN Part ON PartDrawing.PartNo = Part.PartNo 
              WHERE 
                  Part.InStock IS NULL
              GROUP BY PartDrawing.DrawingNo 
              HAVING COUNT(*)>0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Should I implement named parameters in Java using Hash tables? I saw this entry:
I have a number of static classes that contain tables like this: using System;
I am traversing an XML file (that contains multiple tables) using XSLT. Part of
I need to make this trigger work using three tables. Does anyone see a
I have this table structure and would like to map it using Fluent Hibernate
I have a table like this (using wordpress) +---------+----------+------------+ | meta_id | meta_key |
I have this table: fourn_category (id , sub) I am using this code to
I have a database table using an enum. This is already working with hibernate
I have been trying to parse the bottom table on this site using different
I have a stored procedure that updates a table using linq, eg: (this is

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.