简体   繁体   中英

Oracle Style Joins in SQL Server

Is there a way to do oracle style joins in SQL Server?

select * 
from t1, t2
where t1.id = t2.id (+)

EDIT

Why is it preferable to use the "left outer join" and "inner join" types instead? I find it easier to read the older form, especially if there are complex table joins involved.

Microsoft is using the ANSI ISO SQL Standard. Mark Rittman has a good explanation of ANSI joins and why you should use them . SQL Server, however, doesn't support the NATURAL JOIN syntax that's listed in that article and the ANSI standard. You may be more familiar with the old Oracle syntax, but it is the standard and something that you'll find on other database products.

To answer your question - there is no way to perform Oracle style joins on SQL Server. Even the *= and =* style joins have been deprecated and are being removed completely in the next version of the product.

SELECT *
FROM t1
LEFT OUTER JOIN t2 ON t1.id = t2.id

This AskTom article shows you the syntax equivalencies from (+) to (LEFT AND RIGHT) OUTER JOIN for Oracle, and SQL Server uses the OUTER JOIN syntax.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM