Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Short Join Syntax? Expand / Collapse
Author
Message
Posted Thursday, July 10, 2014 5:22 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 155, Visits: 586
I swear I remember reading somewhere about an alternate, shorter JOIN syntax in cases where the column being joined has the same name in both tables. But I can't seem to find a reference to it by Googling. Am I misremembering?

It was something like this:
SELECT T1.ColID
FROM T1
INNER JOIN T2 ON ColID




"If I had been drinking out of that toilet, I might have been killed." -Ace Ventura
Post #1591372
Posted Thursday, July 10, 2014 5:57 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:58 PM
Points: 6,259, Visits: 7,453
autoexcrement (7/10/2014)
I swear I remember reading somewhere about an alternate, shorter JOIN syntax in cases where the column being joined has the same name in both tables. But I can't seem to find a reference to it by Googling. Am I misremembering?

It was something like this:
SELECT T1.ColID
FROM T1
INNER JOIN T2 ON ColID



I've never seen that in T-SQL. MySQL maybe?



- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1591377
Posted Thursday, July 10, 2014 6:39 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 155, Visits: 586
I think it was in one of my Louis Davidson books, it was almost definitely T-SQL. But I'll have to go try to dig it up.


"If I had been drinking out of that toilet, I might have been killed." -Ace Ventura
Post #1591393
Posted Friday, July 11, 2014 2:22 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:43 PM
Points: 43,047, Visits: 36,206
T-SQL has no join constructs like that.

Oracle (iirc) has a NATURAL JOIN which joins on the foreign key columns, but SQL Server doesn't have that



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1591474
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse