Home All Groups Group Topic Archive Search About

Convert *= / =* to outer joins (ANSI compliant)

Author
10 Apr 2007 1:40 AM
Joan
Hi,

I'm working on converting *= and =* to 'left outer join' and 'right outer
join'.

I noticed the difference in behavior between the =* and the phrase "right
outer join" and between *=  and 'left outer join'. The result set is
different. Here is an example:

select a.au_id, b.title, c.qty

from titleauthor a, titles b, sales c

where (a.title_id =* b.title_id)

and (a.title_id =* c.title_id)

I try to conver the above to:

select a.au_id, b.title, c.qty

from titleauthor a

right outer join titles b

on (a.title_id = b.title_id )

right outer join sales c

on (a.title_id = c.title_id )

The first results into 391 rows in pubs database of sql-server 2000 and the
second produces 34 rows. It seems not that straight forward to convert.

The question is: If I want to get 391 row, what should I change/add in the
second sql statement?

Thank you. Appreciate your help.

Joan

AddThis Social Bookmark Button