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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:40:15+00:00 2026-05-31T13:40:15+00:00

Not sure how to work this but I found a way that works although

  • 0

Not sure how to work this but I found a way that works although some of the columns have incorrect data in them. So for now, I’ll leave this with a SOLVED indication but I may need this documentation for other assistance. It could be deleted though.

Sorry, but I don’t think that the answer lies in the “questions with similar titles”. I could well be wrong but I have searched and searched for documentation I can understand but it’s probably like my old days with the IBM manuals for main frames. If you don’t know the exact word you won’t find the answer.

So here goes:

SELECT * FROM membership LEFT JOIN address2 USING(memno)
CROSS JOIN contact USING(memno)
CROSS JOIN workers USING(memno)
CROSS JOIN comments USING(memno)
JOIN candidates USING(memno)

Tried this a number of ways. I thought about saying I tried it every way possible but I obviously did not do it the right way at least. When I do just the first line I get all the right columns and I get all five rows of the tables in my db.

When I add the second line it works but I only get two rows. It works through the “comments” line. It doesn’t do the last line “candidates”.

What I need to be getting is all five rows (the number of rows in the membership table).

Cross join is one problem. I think that it limits the rows as there are only two rows in one of the tables and it goes both ways on the limits.

So I think that what I need is the correct JOIN for the second, third, and fourth line and likely another JOIN type for the last line.

I have very limited hair to tear out so I need your help please.

  • 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-31T13:40:17+00:00Added an answer on May 31, 2026 at 1:40 pm

    Well, without knowing your table schema, data nor having a clear expected result it is a bit difficult to guess what you’re looking for. But this will get you all rows from the membership table regardless of whether they have a match or not on the other tables:

    SELECT * FROM membership
    LEFT JOIN address2 USING(memno)
    LEFT JOIN contact USING(memno)
    LEFT JOIN workers USING(memno)
    LEFT JOIN comments USING(memno)
    LEFT JOIN candidates USING(memno)
    

    Edit:

    Personally, I wouldn’t trust USING when using chained left joins like this. I would make sure by explicitly adding the table to join:

    SELECT * FROM membership m
    LEFT JOIN address2 a on m.memno = a.memno
    LEFT JOIN contact con on m.memno = con.memno
    LEFT JOIN workers w on m.memno = w.memno
    LEFT JOIN comments com on m.memno = com.memno
    LEFT JOIN candidates can on m.memno = can.memno
    

    I scanned the documentation on USING and couldn’t find any reference to this, but I meant that I’m not sure from which table it chooses the columns. This:

    SELECT * FROM membership m
    LEFT JOIN address2 a on m.memno = a.memno
    LEFT JOIN contact con on m.memno = con.memno
    

    Is using alias m as the left part of the left join, so I’m sure I’ll see all memebers, regardless of the fact that thay have or not a contact or an address. However, this:

    SELECT * FROM membership m
    LEFT JOIN address2 a USING(memno)
    LEFT JOIN contact c USING(memno)
    

    Is not clear on from what table is using the memno when joining with contact. In the first left join of the previous example there is no other table to choose so it will join m and a and m will be the left part. But when joining c you will have 2 memno: m.memno and a.memno. If the USING chooses m, then the query will be the same, but if it chooses c, the previous query will translate to:

    SELECT * FROM membership m
    LEFT JOIN address2 a on m.memno = a.memno
    LEFT JOIN contact c on a.memno = c.memno
    

    I think this is not what you’re looking for. Don’t think it is a bad practice specifying the fields and the tables they come from… the intentions are clearer that way.

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

Sidebar

Related Questions

Not sure if I've just missed something but this doesn't work: $(this).children('td.threadtitle a').html('thread title');
I am not sure if Exceptions work the same way in each language, but
I'm not 100% sure I'm doing this right, but I think I've found an
Not sure exactly what I need to do to make this work, so my
I'm still not sure I totally get how this particular case should work out.
I'm trying to get this expression to work, I'm pretty sure its not the
Not sure if im just being stupid or something but here goes i work
I am not sure about how NSSet's anyObject work. What does it mean that
return false seems to work in the submitHandler but I'm not sure why. function
Okay, so not sure if apple.stackexchange is a better place for this, but I

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.