How many orders have more than two invoices?
select count ( * ) from ( select * from invoices as t1 join orders as t2 on t1.order_id = t2.order_id group by t2.order_id having count ( * ) > 2 )
What are the order IDs and details?
select t2.order_id, t2.order_details from invoices as t1 join orders as t2 on t1.order_id = t2.order_id group by t2.order_id having count ( * ) > 2
What are the customer ID's for these orders?
select t2.customer_id from invoices as t1 join orders as t2 on t1.order_id = t2.order_id group by t2.order_id having count ( * ) > 2