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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:11:42+00:00 2026-05-30T00:11:42+00:00

I have a query that requires what I think is a complicated JOIN. I

  • 0

I have a query that requires what I think is a complicated JOIN. I have three tables that are sort of “children” of each other. The top table is “clan_members”. The next is “roster_members” which gets the clan_member id. The bottom one is “match_players” which gets the roster_members id. I wrote a loop that takes me through all of the results in the clan_members table. What I want to do is find out how many matches that clan member has played in. Here’s the layouts of the three tables:

[clan_members]
     -id
     - member_id
     -join_date

[roster_members]
     - id
     - clan_member_id
     - title

[match_players]
     - id
     - roster_member_id
     - match_id

I have never done a JOIN with three different tables before and I have no idea what order to do them in. I would greatly appreciate it if someone could write me a query!

  • 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-30T00:11:44+00:00Added an answer on May 30, 2026 at 12:11 am

    This query will get you the number of matches that clan member with id 123 has participated in:

    select count(*) as match_count
    from clan_members c, roster_members r, match_players m
    where c.member_id = r.clan_member_id
    and r.id = m.roster_member_id
    and c.id = 123
    

    On a side note, it would be good practice to name your columns consistently. For example, all columns that have the clan_member_id should be named the same. In the clan_members table its called id but in the roster_members table its called clan_member_id. Just makes it easier to understand how the tables join together.

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

Sidebar

Related Questions

I'd like a query that at its simplest will join 2 tables together with
I am using in C# MYsql .I have query that works if I run
I have a query that looks like SELECT P.Column1, P.Column2, P.Column3, ... ( SELECT
I have a query that I know can be done using a subselect, but
I have a query that updates one record, and only one record. Is there
I have a query that looks a bit like this: SELECT weekEnd, MAX(timeMonday) FROM
I have a query that might be executed by several users consecutively. I'm scared
I have a query that shows me a listing of ALL opportunities in one
I have a query that uses a where clause. At times, this may be
I have a query that returns a result set similar to the one below:

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.