Reply to Difference on condition in JOIN & WHERE

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация