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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:34:45+00:00 2026-05-20T12:34:45+00:00

Which is better in performance [Subquery] or [join]? I have 3 tables related to

  • 0

Which is better in performance [Subquery] or [join]?

I have 3 tables related to each other, and i need to select data from one table that has some fields related to the other 2 tables, which one from the following 2 SQL statements is better from the view of performance :

select Table1.City, Table1.State, Table2.Name, Table1.Code, Table3.ClassName 
from Table1 inner join Table2 on Table1.EmpId = Table2.Id inner join Table3
on Table1.ClassId = Table3.Id where Table.Active = 1

OR

select City, State, (select Name from Table2 where Id = Table1.EmpId) as Name, Code,
(select ClassName from Table3 where Id = Table1.ClassId) as ClassName from Table1
where Active = 1

I have tried the execution plan but its statistics is not expressive to me because the current data is a test data not real one, so i can’t imagine the amount of data when tables are live of course they will be more than the test one.

Note : The Id field in Table2 and Table3 is primary key

Thanks in advance

  • 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-20T12:34:46+00:00Added an answer on May 20, 2026 at 12:34 pm

    The first approach, with joins, is by far faster. In second the query will be executed for each row. Some databases optimize nested queries into joins though.

    Join vs. sub-query

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

Sidebar

Related Questions

which one has better performance? SELECT *,(SELECT MAX(old) FROM employee WHERE employee.CompanyId = Company.Id)
Which one is better from performance view user control or custom control? Right now
Which would have better performance? $('input[data-confirm],a[data-confirm],button[data-confirm]'); or $('[data-confirm]'); Obviously the $('[data-confirm]') version of the
I am unsure on which approach will give me a better performance: I have
Which one of the C# <Key, Value> structure implementations has better performance and higher
Between HtmlSelect and DropDownList, which one has a better performance (initialized and rendered faster)?
Which option is better from Best practices point of view and from performance point
Which method is better and why, when? In terms of scalability,performance etc which one
Which one has better performance? setting image property of one control in design-time or
Which is better for performance? This may not be consistent with other programming languages,

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.