2

I'm looking at a section of "A Guide to the SQL Standard" (C.J.Date/Hugh Darwen) concerning LEFT JOIN and it gives the following syntax:

table-reference [ NATURAL ] outer-join-type
                            JOIN table-reference
                           [ ON conditional-expression   
                           | USING ( column-commalist ) ]

What is USING?
Is it useful?
Is it implemented in SQL-Server?

whytheq
  • 34,466
  • 65
  • 172
  • 267
  • [this](http://stackoverflow.com/questions/11366006/mysql-on-vs-using) should answer your first question. and [this](http://connect.microsoft.com/SQLServer/feedback/details/153679/natural-join-and-using-clause-in-joins) your third – TsSkTo Aug 30 '13 at 07:54
  • 1
    For every SQL database engine, there are parts of the SQL Standard that are **not** implemented. For SQL Server, this is one of those parts. – AakashM Aug 30 '13 at 08:21
  • @AakashM I know the situation about different dialects picking and choosing different sections to implement - was just interested to know a little more about this specific operator from the sql-server prespective – whytheq Aug 30 '13 at 09:31

2 Answers2

4

No, it's not supported by SQL Server, see FROM:

<joined_table> ::= 
{
    <table_source> <join_type> <table_source> ON <search_condition> 
    | <table_source> CROSS JOIN <table_source> 
    | left_table_source { CROSS | OUTER } APPLY right_table_source 
    | [ ( ] <joined_table> [ ) ] 
}

As to what it is? It's a way of performing a join between two tables where the column names in both tables exactly match, and as a convenience, it allows you to name the columns only once. Compare that to using ON to achieve the same:

ON
   table1.columnA = table2.columnA AND
   table1.columnB = table2.columnB AND
   table1.columnC = table2.columnC

with USING it's just:

USING (columnA,columnB,columnC)
Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448
3

No, the USING clause for joins isn't supported in SQL Server (or Sybase). You'll need to continue to use ON clauses.

There's a request on MSDN connect to have it implemented here - but as it was suggested in 2006 and not implemented yet, I wouldn't hold your breath!

Bridge
  • 29,818
  • 9
  • 60
  • 82