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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:02:03+00:00 2026-05-10T23:02:03+00:00

Is this … T1 join T2 using(ID) where T2.VALUE=42 … the same as …

  • 0

Is this

... T1 join T2 using(ID) where T2.VALUE=42 ... 

the same as

... T1 join T2 on(T1.ID=T2.ID) where T2.VALUE=42 ... 

for all types of joins?

My understanding of using(ID) is that it’s just shorthand for on(T1.ID=T2.ID). Is this true?

Now for another question:

Is the above the same as

... T1 join T2 on(T1.ID=T2.ID and T2.VALUE=42) ... 

This I don’t think is true, but why? How does conditions in the on clause interact with the join vs if its in the where clause?

  • 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. 2026-05-10T23:02:03+00:00Added an answer on May 10, 2026 at 11:02 pm

    I don’t use the USING syntax, since

    1. most of my joins aren’t suited to it (not the same fieldname that is being matched, and/or multiple matches in the join) and
    2. it isn’t immediately obvious what it translates to in the case with more than two tables

    ie assuming 3 tables with ‘id’ and ‘id_2’ columns, does

    T1 JOIN T2 USING(id) JOIN T3 USING(id_2) 

    become

    T1 JOIN T2 ON(T1.id=T2.id) JOIN T3 ON(T1.id_2=T3.id_2 AND T2.id_2=T3.id_2) 

    or

    T1 JOIN T2 ON(T1.id=T2.id) JOIN T3 ON(T2.id_2=T3.id_2) 

    or something else again?

    Finding this out for a particular database version is a fairly trivial exercise, but I don’t have a large amount of confidence that it is consistent across all databases, and I’m not the only person that has to maintain my code (so the other people will also have to be aware of what it is equivalent to).

    An obvious difference with the WHERE vs ON is if the join is outer:

    Assuming a T1 with a single ID field, one row containing the value 1, and a T2 with an ID and VALUE field (one row, ID=1, VALUE=6), then we get:

    SELECT T1.ID, T2.ID, T2.VALUE FROM T1 LEFT OUTER JOIN T2 ON(T1.ID=T2.ID) WHERE T2.VALUE=42 

    gives no rows, since the WHERE is required to match, whereas

    SELECT T1.ID, T2.ID, T2.VALUE FROM T1 LEFT OUTER JOIN T2 ON(T1.ID=T2.ID AND T2.VALUE=42) 

    will give one row with the values

    1, NULL, NULL 

    since the ON is only required for matching the join, which is optional due to being outer.

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

Sidebar

Ask A Question

Stats

  • Questions 80k
  • Answers 80k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A solution is a project aggregator. If you have several… May 11, 2026 at 4:18 pm
  • Editorial Team
    Editorial Team added an answer A pipe/bar character generally represents "or" with regexps. You could… May 11, 2026 at 4:18 pm
  • Editorial Team
    Editorial Team added an answer this could perfectly be achieved by using CompositeWPF's RegionManager by… May 11, 2026 at 4:18 pm

Related Questions

I am currently running into a problem where an element is coming back from
Is this statement, “i see him last night” can be understood as “I saw him last night”?
Is this type of control only available in a 3rd-party library? Has someone implemented
Is this function declaration in C#: void foo(string mystring) the same as this one
Is this possible? I want to have the To:, Body, and an Attachment all

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.