They do not appear the same to me from a readability/convention standpoint.
The first one c & d are defining the join and f is describing a desired individual characteristic In the second one c is defining the join and f & d are describing desired individual characteristics For example, here are two tables that hold a value relative to a third table, not necessarily associated with each other. test_b (a_id, value) test_c (a_id, value) The following SQL produces 1 result because not only do the ids have to match, but the values as well, and neither value can equal 0 SELECT * FROM test_b b INNER JOIN test_c c ON b.a_id = c.a_id AND b.value = c.value WHERE b.value <>0 AND c.value <>0 It can be rewritten: SELECT * FROM test_b b INNER JOIN test_c c ON b.a_id = c.a_id WHERE b.value <>0 AND c.value <>0 AND b.value = c.value Or be rewritten: SELECT * FROM test_b b INNER JOIN test_c c WHERE b.value <>0 AND c.value <>0 AND b.value = c.value AND b.a_id = c.a_id They all produce the same result (as far as speed, I would have to check with a large complicated dataset), but I would say the first one is the easiest to understand (with the third one coming in closely). Just my thoughts, Justin Giboney On Mon, Jun 21, 2010 at 11:25 AM, Wade Preston Shearer < [email protected]> wrote: > There's no difference (performance and results) between the following two > queries, right? (I get the same results.) > > SELECT > FROM a > INNER JOIN b > ON c > AND d > WHERE f > > > SELECT > FROM a > INNER JOIN b > ON c > WHERE f AND d > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
