2

I have just picked up an SQL statement that was written by someone a couple of weeks ago (nobody seems to know who).

As part of the statement, in the WHERE clause, they have something like: {table1.field} *= {table2.samefield}.

What exactly is going on here? I assume some sort of join, but what join and why and, generically, why would someone put this in the WHERE clause?

Cheetah
  • 13,785
  • 31
  • 106
  • 190
  • Similar to Programming Language A*=B. ---> A=A*B; – SenthilPrabhu Apr 16 '13 at 09:41
  • @Senthil Prabhu: Worth a thought but it's actually a left outer join operator in Sybase (non-ANSI). Same as how Oracle has its proprietary (+) annotation to it's join operator. Use of ANSI-standard SQL would be a cross-DBMS recommendation. – wmorrison365 Apr 16 '13 at 09:50
  • @Ben: If u looking with regards of ANSI have a look at http://stackoverflow.com/questions/3684259/sql-joins-future-of-the-sql-ansi-standard-where-vs-join – SenthilPrabhu Apr 16 '13 at 09:54

2 Answers2

1

This appears to be Sybase's outer join annotation:

Include in the results all the rows from the first table, not just the ones where the joined columns match.

See: Sybase docs

wmorrison365
  • 5,995
  • 2
  • 27
  • 40
0

It's the SyBase join operator equivalent to a more conventional LEFT OUTER JOIN (or more commonly, LEFT JOIN.

Refer: SyBooks Online - The WHERE clause

*=

Include in the results all the rows from the first table, not just the ones where the joined columns match.

As opposed to the =* which is a RIGHT OUTER JOIN (or more commonly RIGHT JOIN).

Sepster
  • 4,800
  • 20
  • 38