|
Re: SQL Question: msg#00032cms.cold-fusion.user.azcfug
Hi Judd: Well basically the SQL statement is not correct. You should do something like this. SELECT states.state, establishments.stateCode, Establishments.EstablishmentKey FROM Establishments LEFT JOIN States ON States.StateCode = Establishments.EstablishmentStateCode WHERE Establishments.EstablishmentKey = 14408 You have to assign the alias name (states or Establishments) in the select clause which will tell the Query that what column you want to see. This statement is equal to this. SELECT states.state, establishments.stateCode, Establishments.EstablishmentKey FROM states, Establishments where States.StateCode = Establishments.EstablishmentStateCode and Establishments.EstablishmentKey = 14408 Basically, there is no difference between Left join and Right join unless you want to use Outer join. It will be much clear to check the document in SQL help. LEFT [OUTER] Specifies that all rows from the left table not meeting the join condition are included in the result set, and output columns from the other table are set to NULL in addition to all rows returned by the inner join. RIGHT [OUTER] Specifies all rows from the right table not meeting the join condition are included in the result set, and output columns that correspond to the other table are set to NULL, in addition to all rows returned by the inner join. Terence Chang ----- Original Message ----- From: Judd M. Miller <juddmiller@xxxxxxxxxxxxx> To: <azcfug-VgYJa0VH1e9BDgjK7y7TUQ@xxxxxxxxxxxxxxxx> Sent: Tuesday, July 11, 2000 12:38 PM Subject: [azcfug] SQL Question > Hi, gang, > > I understand the basic syntax of a left join, e.g.: > > SELECT * FROM Establishments > LEFT JOIN States ON > States.StateCode = Establishments.EstablishmentStateCode > WHERE EstablishmentKey = 14408 > > ....and I understand that such a join will pull a unique row from a > separate table (states) based on the tie between them (statecode). > > Can I indicate WHICH columns of that joined States row I want to pull, > or do I have to pull the whole thing? What if a States column has the > same name as a column in the Establishments table? > > Also, where do you all commonly use left joins? And what are right > joins? Can some of you help me understand some of the ins and outs of > these creatures? > > Thanks! > > ---Judd Miller > > > __________________________________________________ > Do You Yahoo!? > Get Yahoo! Mail - Free email you can access from anywhere! > http://mail.yahoo.com/ > > ------------------------------------------------------------------------ > Get a NextCard Visa, in 30 seconds! > 1. Fill in the brief application > 2. Receive approval decision within 30 seconds > 3. Get rates as low as 2.9% Intro or 9.9% Fixed APR > http://click.egroups.com/1/6630/13/_/_/_/963344994/ > ------------------------------------------------------------------------ > > To unsubscribe from this group, send an email to: > azcfug-unsubscribe-VgYJa0VH1e9BDgjK7y7TUQ@xxxxxxxxxxxxxxxx > > __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | cold fusion hosting: 00032, Preston Korn |
|---|---|
| Next by Date: | Re: cold fusion hosting: 00032, Judd M. Miller |
| Previous by Thread: | SQL Questioni: 00032, Judd M. Miller |
| Next by Thread: | David Orfao: 00032, brett |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |