What does =* mean?

2019-01-04 03:08发布

I'm trying to trace some SQL in Microsoft Server. I came across a join that is using a convention unfamiliar to me. What does "=*" mean?

WHERE table1.yr =* table2.yr -1

11条回答
对你真心纯属浪费
2楼-- · 2019-01-04 03:27

I believe that is old syntax indicating an outer join condition from table1 to table2

Old style:

SELECT * FROM table1, table2
WHERE table1.yr =* table2.yr -1

New style (SQL92):

SELECT * FROM table2 
LEFT OUTER JOIN table1 ON table1.yr = table2.yr - 1
查看更多
▲ chillily
3楼-- · 2019-01-04 03:29

This is the old style of joins which were deprecated in ANSI SQL92. New syntax uses INNER and OUTER JOIN which join tables based on expressions rather than equality

查看更多
等我变得足够好
4楼-- · 2019-01-04 03:29

A ??? outer join is specified using the symbol =* in place of = in the WHERE clause.

查看更多
beautiful°
5楼-- · 2019-01-04 03:31

This:

WHERE t.column =* s.column

...is old TSQL (pre SQL Server 2005) outer join syntax, and is not an ANSI JOIN.

Reference: SQL Server 2005 Outer Join Gotcha

查看更多
等我变得足够好
6楼-- · 2019-01-04 03:32

That is the ANSI SQL 1989 syntax for RIGHT OUTER JOIN, where *= would be the LEFT OUTER JOIN.

You should note also that putting the join syntax in the WHERE clause is deprecated in SQL 2008. http://scarydba.wordpress.com/2009/09/15/no-join-predicate/ <== A timely article on this.

查看更多
啃猪蹄的小仙女
7楼-- · 2019-01-04 03:33

There are a lot of silly answers here. You didn't give the FROM clause, so there's no way to tell if your *= represents a LEFT or a RIGHT outer join.

WHERE table1.yr =* table2.yr -1

is old syntax for an outer join, for sure. But anyone who claims to know whether it's a LEFT or RIGHT outer join is mistaken. It depends on the order in which table1 and table2 are named in the FROM clause, and that's not given.

查看更多
登录 后发表回答