I always though join gets the results of something and then joins only using those results.
SELECT * FROM tbl AS t1
JOIN tbl2 AS t2 ON t1.id = t2.foreignId
JOIN tbl3 AS t3 ON t2.id = t3.foreignId
WHERE t1.date > SOMEDATE
From my understanding it will run the where statement and get only the results that fall within the date range. Then it will go through all of t2 and only try to match ids that connect to t1 (which may make the results smaller). Then with this smaller potential results it will do the same for T3 and output the final results.
But it appears that is NOT how this works? And the tables multiply instead of getting smaller. And apparently what i am describing above is more like subqueries? (NOTE that i said LIKE. I dont know how subquerys work)
How does JOIN work and what is the difference between a JOIN and a subquery?
I use both MySql and SQLite. I dont know if thats relevant.