If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > JOIN USING method

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-05, 06:10
gtk gtk is offline
Registered User
 
Join Date: Oct 2004
Location: Paris, FRANCE
Posts: 132
Post 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 ?
Reply With Quote
  #2 (permalink)  
Old 09-22-05, 10:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 09-22-05, 10:29
gtk gtk is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 09-22-05, 10:32
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 09-22-05, 10:54
gtk gtk is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On