You are here: Re: Difference on condition in JOIN & WHERE « MsSQL Server « IT news, forums, messages
Re: Difference on condition in JOIN & WHERE

Posted by Ed Murphy on 05/03/07 22:33

Jane T wrote:

> 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.

For equal joins, there's no difference. For left outer joins,
specifying a condition on the join simply causes it to return
rows with data from the left side and NULLs from the right side,
whereas specifying a condition on the WHERE causes it to filter
the output of the JOIN.

Basically, the query is processed in this order:

* FROM/JOIN
* SELECT
* WHERE
* GROUP BY
* HAVING
* ORDER BY

 

Navigation:

[Reply to this 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

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