LazSQL
2012-05-31 12:07:35 UTC
SELECT whatever
FROM table1
INNER JOIN table 2
ON table1.id = table2.id
AND table2.active = 'Y'
Rather than saying "WHERE table2.active = Y" later in the statement.
Is this truly better? Also, is it possible to then somehow filter out rows unnecessary in the first mentioned table, table1? Something like:
SELECT whatever
FROM table1
ON table1.good_stuff = Y
INNER JOIN table2
ON table1.id = table2.id
AND table2.active = Y
Even looks funny. Is there a benefit of making ON clauses more elaborate? Can the first mentioned table even have something like an ON clause? Is there ever a reason to just list the tables such as:
SELECT whatever
FROM table1, table2
WHERE table1.id = table2.id
AND table2.active= Y