how to join a table with a subquery 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