5 ms·
Why not just reverse the SELECT and FROM clauses? FROM table1, table2 SELECT col1, col2 WHERE ... or even better FROM table1 JOIN table2 ON c
by lisper 9y ago
Why not just reverse the SELECT and FROM clauses?
FROM table1, table2
SELECT col1, col2
WHERE ...
or even better
FROM table1 JOIN table2 ON condition ...
SELECT ...
WHERE [additional join conditions]
HAVING [filter conditions]
Then the compound version looks like:
FROM (
FROM tables...
SELECT ...
WHERE
) SELECT...
WHERE ...
or
FROM (
FROM tables ...
SELECT ...
) JOIN [whatever]
SELECT ...
WHERE ...
Actually, putting the WHERE before the SELECT makes even more sense.
- kierenj 9y agoBecause that's invalid SQL?
- lisper 9y agoSo was the WITH clause until someone decided it should be valid and added it. Every improvement to every language ever started out with someone saying, "Hey, here's an idea..." And none of those ideas were ever "valid X" at the time they were proposed.