join
Log from IRC server Freenode (IPv6) channel #SQL.
<me> I'm having a select that I need to join with another table but also includes a where ; I was wondering if there's a way to do the where before the join so it would shorten the join ?
<gnari> me, if you are using a proper DBMS, then it should be able to figure the best way to optimize an inner join by applying a condition before the join in cases where that is beneficial
<me> gnari: ty
<gnari> me, if you want an condition applied to the OUTER side of a JOIN, put the condition into the ON clause instead of the WHERE
<me> gnari: good advice, ty
<me> it's this case actually
<gnari> me, i other words: "select * from foo left join (select * from bar where zzz) AS baz ON foo.x=baz.x" is the same as "select * from foo left join bar on foo.x=bar.x AND zzz
<gnari> "
<me> awesome !
