sql - Separation of JOIN and WHERE clauses -


i have written same join 2 different ways:

select     one.first,     two.second,     three.third     onetable 1      inner join twotable 2         on one.twokey = two.onekey      inner join threetable 3         on two.twokey = three.twokey         , one.onekey = three.onekey  1=1     , one.firstnamefield in ('first name', 'second name', 'third name')     , two.secondnamefield not in ('last name', 'sirname', 'family name')     , three.thirdnamefield = ('nick name', 'pen name', 'handle') 

and

select     one.first,     two.second,     three.third     onetable 1      inner join twotable 2         on one.twokey = two.onekey         , one.firstnamefield in ('first name', 'second name', 'third name')         , two.secondnamefield not in ('last name', 'sirname', 'family name')      inner join threetable 3         on two.twokey = three.twokey         , one.onekey = three.onekey         , three.thirdnamefield = ('nick name', 'pen name', 'handle') 

as see, where portion first goes join in re-written query.

is there difference between two?

is 1 more desirable other?

there no difference in results since using inner joins. however, results quite different if these left joins.

i tend put conditions related join in join clause , conditions related overall filtering (a thin distinction i'll grant you) in clause. so, inclination have been first form.


Comments

Popular posts from this blog

how to build hyperlink for query string in php -

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

queue - mq_receive: message too long -