This Q&A shows how to use USING()
in Mysql to join two tables on columns that are called the same thing in both tables. The advantages are (1) not having to repeatedly specify source tables and (2) no ambiguity in the resulting SELECT
statement when referring to the columns used to join.
I'd like to do that in SQL Server, but I get the warning:
'USING' is not a recognized built-in function name.
Is there a way I can do that in SQL Server? I want this:
SELECT * FROM t1
LEFT JOIN t2 USING (a, b, c)
Not this:
SELECT * FROM t1
LEFT JOIN t2 ON t1.a = t2.a AND t1.b = t2.b AND t1.c = t2.c