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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:35:39+00:00 2026-05-27T22:35:39+00:00

I always seem to get caught up in multiple joins. I have these tables

  • 0

I always seem to get caught up in multiple joins. I have these tables that contain part numbers, then the descriptions for those part numbers are spread across 12 tables (I can’t do anything about that). So I wanted to select only the part numbers I need, then get the descriptions for them by joining all 12 of those tables against my original query.

The result is the that only the first table’s description, for the capacitors ever gets joined. The rest get lost, and I can comment out capacitors and get connectors, and so on down the list but I only ever get one at a time.

Is there a way to do this in SQL? Or am I missing the boat.

Here’s my code:

        cmd.CommandText = "WITH PARTS AS(";
        cmd.CommandText += "SELECT *, ROW_NUMBER() OVER (ORDER BY p.PART_NUMBER) AS 'RowNumber'  FROM  dbo.AllParts AS p"; 
        cmd.CommandText += ")";
        cmd.CommandText += "SELECT * FROM PARTS as p "
        + "INNER JOIN dbo.[Component Manufacturer Parts] AS a ON p.RowID = a.PartGUID "
        + "INNER JOIN dbo.[Manufacturer Part Info] AS b ON a.ManufacturerGUID = b.RowID " 
        + "LEFT Join dbo.[CAPACITORS] as caps ON caps.RowID = p.RowID "
        + "LEFT Join dbo.[Connectors] as cons ON cons.RowID = p.RowID "
        + "LEFT Join dbo.[Crystals and Oscillators] as xtal ON xtal.RowID = p.RowID "
        + "LEFT Join dbo.[Diodes] as dio ON dio.RowID = p.RowID "
        + "LEFT Join dbo.[ICs] as ics ON ics.RowID = p.RowID "
        + "LEFT Join dbo.[Inductors] as ind ON ind.RowID = p.RowID "
        + "LEFT Join dbo.[Misc] as mis ON mis.RowID = p.RowID "
        + "LEFT Join dbo.[Relays] as rel ON rel.RowID = p.RowID "
        + "LEFT Join dbo.[Resistors] as res ON res.RowID = p.RowID "
        + "LEFT Join dbo.[Switches] as swi ON swi.RowID = p.RowID "
        + "LEFT Join dbo.[Transformers] as tra ON tra.RowID = p.RowID "
        + "LEFT Join dbo.[Transistors] as xfrm ON xfrm.RowID = p.RowID "                      
        + "WHERE RowNumber Between @low AND @high AND p.PART_NUMBER LIKE 'CT%'";

Thanks for any advice you can give.

  • 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-27T22:35:40+00:00Added an answer on May 27, 2026 at 10:35 pm

    The reason it doesn’t work is because the first left join isn’t returning anything to match with the second left join.

    How about a view with the descriptions for all of the tables in a big union. It’s pretty ugly but it would certainly be easier to query.

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

Sidebar

Related Questions

I have a site that does four different re-directs and doesn't seem to always
I always seem to use Get when working with data (strongly typed or otherwise)
I always seem to have a hard time starting a new Firefox extension. Can
I'm trying to pass a string to chdir(). But I always seem to have
I seem to always have problems with converting data to and from XML in
I always seem to run into trouble with NSDecimalNumber! Today, I get this error:
I'm new to android programming, but one thing that I can't seem to get
Here is some sample code...I always seem to get a ClassCastException...anybody point out what
I always seem to have this internal struggle when it comes to user interface.
I always seem to trip myself up during these types of SQL Statements. Here

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.