We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
More on JOINS
|
| Subject: |
|
Right outer joins in MS SQL SERVER |
| Date: |
|
2006-01-28 23:31:14 |
| From: |
|
JCrespin
|
Response to: Right outer joins in MS SQL SERVER
|
|
The answer given is correct. There is a cross join between table titles and table sales as you have not defined the join criteria.
If you want to receive the same result that you receive with the right outer join query you have to define the join between titles and sales (see below)...
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)
and (b.title_id = c.title_id)
order by a.title_id
That said, definitely use the second query.
|