sql subqueries join code example
Example: sql join on a subquery
SELECT *
FROM
( SELECT ... FROM ... ) q1
INNER JOIN
( SELECT ... FROM ... ) q2
ON q1.colname = q2.colname
SELECT *
FROM
( SELECT ... FROM ... ) q1
INNER JOIN
( SELECT ... FROM ... ) q2
ON q1.colname = q2.colname