SELECT DISTINCT Customers.customer_id, Customers.first_name
FROM Customers
INNER JOIN Orders
ON Customers.customer_id = Orders.customer_id
ORDER BY Customers.customer_id;
SELECT *
FROM
( SELECT ... FROM ... ) q1
INNER JOIN
( SELECT ... FROM ... ) q2
ON q1.colname = q2.colname