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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:00:56+00:00 2026-06-14T17:00:56+00:00

I stumbled upon this T-SQL query created on a SQL Server 2005 database: Select

  • 0

I stumbled upon this T-SQL query created on a SQL Server 2005 database:

Select s_bs.ScheduleHeaderId, 
       s_bs.ScheduleBatchScheduleId, 
       FlowRateOperational.FlowRate, 
       BatchScheduleFlowRateOperational.EffectiveStartTime, 
       BatchScheduleFlowRateOperational.EffectiveEndTime
From BatchSchedule as bs 
Inner Join ConnectionPoint as cp on bs.ConnectionPointId = cp.ConnectionPointId 
Inner Join ScheduleBatch as s_b 
Inner Join ScheduleConnectionPoint as s_cp 
Inner Join ScheduleBatchSchedule as s_bs 
            on s_cp.ScheduleConnectionPointId = s_bs.ScheduleConnectionPointId 
            on s_b.ScheduleBatchId = s_bs.ScheduleBatchId 
            on cp.ConnectionPointName = s_cp.ConnectionPointName and bs.BatchID = s_b.BatchID 
Inner Join BatchScheduleFlowRateOperational on bs.BatchScheduleId = BatchScheduleFlowRateOperational.BatchScheduleId 
Inner Join FlowRateOperational on BatchScheduleFlowRateOperational.FlowRateOperationalId = FlowRateOperational.FlowRateOperationalId

I am not a SQL expert by far but at least I think I know how to join tables and I had never seen this way of joining tables before.

Is having several ON clauses together after their JOINS producing different results or increasing performance?

Why couldn’t this person just move the joins around and keep the ON clauses beside their corresponding JOIN?

Thanks for any light you can shed on this “mystery” 🙂

  • 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-14T17:00:58+00:00Added an answer on June 14, 2026 at 5:00 pm

    The ON clause can be placed right after each INNER JOIN (which looks nicer to me). But sometimes it’s inevitable to put the ON clauses for the first couple of joins after a later join. For example the table which provides the join condition is not yet available in the JOIN chain, for example:

    SELECT * FROM 
    A INNER JOIN 
    B INNER JOIN 
    C 
       ON B.Col1 = C.Col1 
       ON A.Col2 = C.Col2
    

    Look that both ON clauses are referring to C so the associated ON clause could not appear earlier. It can be prevented by putting C first, but depending on the usage, one may find it less readable.

    The above is just from the syntax point of view. There should be some performance considerations as well, which I’m not aware of.

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

Sidebar

Related Questions

The original problem I tried to solve when stumbled upon this was to select
I was doing some querying today in T-SQL, SQL-Server-2008 and stumbled upon something weird
I stumbled upon this problem and it took my a while to realise what
I stumbled upon this code and I am curious as to what use may
I stumbled upon this question: 7 power 7 is 823543. Which higher power of
I stumbled upon this while doing a review and the author is not available:
Today I stumbled upon this thread: http://www.mathworks.com/matlabcentral/newsreader/view_thread/112560 The question is basically how to make
I got stumbled upon this issue once and I guess I need some expertise
So I stumbled upon this "new" graphics engine/technology called Unlimited Detail . This seems
I'm pretty new in iphone programming and have stumbled upon this issue which 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.