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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:16:36+00:00 2026-05-31T01:16:36+00:00

There are 4 sql tables: Listings(Amount, GroupKey, Key, MemberKey), Loans(Amount, GroupKey, Key, ListingKey), Members(City,

  • 0

There are 4 sql tables:

Listings(Amount, GroupKey, Key, MemberKey),
Loans(Amount, GroupKey, Key, ListingKey),
Members(City, GroupKey, Key)
Groups(GroupRank, Key, MemberKey)

Now, if one wants to find out the loans which are also listings and find the members city and GroupRank for the members in the loan table. Here, the group table contains information about grous of which members are a part of.
and also perform a select operation as given below:

select Listings.Amount, Members.City, Groups.GroupRank
from listings, loans, members, groups
where Listings.Key=Loans.ListingKey and
    Members.Key=Listings.MemberKey and
    Listings.GroupKey=Groups.Key 

The above join is giving an incorrect result, please point out where I am going wrong.
Also I am new to SQL so please excuse the novice question.

  • 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-31T01:16:38+00:00Added an answer on May 31, 2026 at 1:16 am

    Note: The following is just a guess what your problem is. Like others said, clearify your question.

    You want to JOIN
    ( http://dev.mysql.com/doc/refman/5.1/de/join.html )
    those tables. What you write is just another form of a join, meaning it has the same effect. But you “joined” a bit too much. To make things clearer a syntax has been invented to make things clearer and avoid such mistakes. Read more about it in the link given above.

    What you want to achieve can be done like this:

    SELECT
    Listings.Amount, Members.City, Groups.GroupRank
    FROM
    Listings
    INNER JOIN Groups ON Listings.GroupKey=Groups.Key
    INNER JOIN Members ON Members.Key=Listings.MemberKey
    

    You don’t do a SELECT on the Loans table, you don’t need it in this query.

    This is the INNER JOIN which will give you a result where every row in table A has an according entry in table B. When this is not the case, you have to use the LEFT or RIGHT JOIN.

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

Sidebar

Related Questions

Is there a SQL command that will list all the tables in a database
Is there a SQL statement that will list the names of all the tables,
In SQL Server there is a way to join tables from multiple sql servers
SQL query which select the record from three tables and there is no relation
We have two tables in a SQL Server 2005 database, A and B.There is
We have a few tables with persisted computed columns in SQL Server. Is there
I'm from SQL world, so please, don't ask me that there are no tables,
There are two SQL tables: Parents: +--+---------+ |id| text | +--+---------+ | 1| Blah
I have a 2 tables in a MS SQL 2008 Database, Listings and ListingType,
How many records should there be before I consider indexing my sql tables?

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.