|
Posted by Jane T on 05/03/07 20:58
I appreciate how difficult it is to resolve a problem without all the
information but maybe someone has come across a similar problem.
I have an 'extract' table which has 1853 rows when I ask for all rows where
period_ = 3. The allocation table for info has 210 rows.
I have two scripts below. The first script where I specify a period on a
join, brings back 1853 lines and works. The second script where I specify
the period in the where clause only brings back 1844 rows. I have located
the missing 9 rows and they don't look any different to the other 1844 rows.
Can someone educate me as to the difference between specifying a condition
on a join and a condition in a where clause.
SELECT
a.costcentre_,
b.nett_,
a.*,
b.*
FROM extract a
LEFT OUTER JOIN
allocation b
ON a.e_reg_ = b.reg_no_
AND b.period_ = 3
WHERE
a.period_ = 3
--------------
SELECT
a.costcentre_,
b.nett_,
a.*,
b.*
FROM extract a
LEFT OUTER JOIN
allocation b
ON a.e_reg_ = b.reg_no_
WHERE
a.period_ = 3
AND b.period_ = 3
[Back to original message]
|