Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004
    Location
    Paris, FRANCE
    Posts
    132

    Post Unanswered: JOIN USING method

    Maybe the question have been already asked before.
    I didn't find any topic performing a search on 'using' keyword.

    Here is the little question:
    If I have this query
    Code:
    SELECT
     a.x,
     a.y,
     a.z
    FROM
     a
     INNER JOIN b
      ON (a.x = b.x)
     INNER JOIN c
      USING (y)
    During the 'c' table join the 'y' field will be used for joinning with
    - a
    - b
    or both ?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by gtk
    During the 'c' table join the 'y' field will be used for joinning with
    - a
    - b
    or both ?
    that's a good question and one of the reasons why i recommend that people should not use USING, just code the conditions explicitly
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Oct 2004
    Location
    Paris, FRANCE
    Posts
    132
    That's what I thought.
    So USING and NATURAL are to be banned.
    I'll never use them, even when I can.
    Because I think we must code always the same way.
    Do you know a good site where I can find a norm or something like that, which says the things to do and not to do ?

    We all need norms

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i know what you mean, that is often called "best practices"

    unfortunately this can only be mastered with experience, as all situations are different and what you do in one case is not necessarily what you'd do in another
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Oct 2004
    Location
    Paris, FRANCE
    Posts
    132
    I agree.
    But I think we can easily say for example that we have to ban certain fonctions.
    In my school, I have been imposed norms for C, and it have been proven usefull in term of optimisation, interoperability, maintenance and speed of developpement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •