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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:27:44+00:00 2026-06-06T16:27:44+00:00

I was wondering how exactly inner joins works in mysql. If I do SELECT

  • 0

I was wondering how exactly inner joins works in mysql.

If I do

SELECT * FROM A a 
INNER JOIN B b ON a.row = b.row
INNER JOIN C c ON c.row2 = b.row2
WHERE name='Paul';

Does it do the joins first, then pick the ones where name = paul? Because when I do it this way, it is SUPER DUPER slow.

is there a way to do something along the lines:

SELECT * FROM (A a WHERE name='paul')
INNER JOIN B b ON a.row = b.row
INNER JOIN C c ON c.row2 = b.row2]

When I try it that way, I just get an error.

or alternately, is it better to just have 3 separate queries, one for A, B and C? example:

string query1 = "SELECT * FROM A WHERE name = 'paul'";
//send query, get data reader
string query2 = "SELECT * FROM b WHERE b = " + query1.b;
//send query, get data reader
string query3 = "SELECT * FROM C WHERE c = " + query1.c;
//send query, get data reader

Obviously this is just pseudo code, but I think it illustrates the point.

Which way is faster/recommended?

Edit
Table structure:

**tblTimesheet**
int timesheetID (primary key)
datetime date
varchar username
int projectID
string description
float hours

**tblProjects**
int projectID (primary key)
string project name
int clientID

**tblClients**
int clientID
string clientName

The join that I want is:

select * from tblTimesheet time
INNER JOIN tblProject proj on time.projectID = proj.projectID
INNER JOIN tblClient client on proj.clientID = client.clientID
WHERE username = 'paul';

something like that

  • 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-06T16:27:45+00:00Added an answer on June 6, 2026 at 4:27 pm

    You are probably missing an index on a key table; you can use the MySql EXPLAIN keyword to help in finding out where your query is slow.

    To answer another section of your question;

    is there a way to do something along the lines:
    
    SELECT * FROM (A a WHERE name='paul')
    INNER JOIN B b ON a.row = b.row
    INNER JOIN C c ON c.row2 = b.row2]
    

    You can use a SubQuery;

    SELECT * 
    FROM (SELECT * FROM  tblTimesheet WHERE username = 'Paul') AS time
    INNER JOIN tblProject proj on time.projectID = proj.projectID
    INNER JOIN tblClient client on proj.clientID = client.clientID
    

    What this query is effectively doing is attempting to prefilter the fields the JOIN will operate on. Rather than join all the fields to together, and then filter those down, it only attempts to JOIN fields from tblTimesheet where the name is ‘Paul’ first.

    However, the query optimizer should already be doing this so this query should perform similarly to your original query.

    For more help with indexes, the understanding of which will aid you greatly in database development, start by looking at a tutorial like this one.

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

Sidebar

Related Questions

I'm just wondering how exactly does a delegate method know when to be called?
I'm wondering how exactly the XAML sample ( MSDN sample ) works: <Style x:Key=textBoxInError
I was wondering how exactly does TCP implement in-order delivery. lets say this is
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible
I was just wondering how exactly memory works such that a language standard (such
I am wondering what exactly setPropagationBehavior of the TransactionTemplate does. Who propagats what to
I'm wondering how exactly to perform a 3-way join using the following structure (much
I am wondering how exactly the following piece of code works (yes, it indeed
I'm just wondering exactly what factors affect how quickly createthread executes, and how long
I was reading litb's question about SFINAE here and I was wondering exactly what

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.