Count and sum, counted and summed values
My goal is to find distinct number of order_ids and total amount of all order_items associated with these order_ids


You can get same result using a single query:

SELECT
  COUNT(DISTINCT order_id) AS total_orders, 
  SUM(invoice_amount) AS total_invoice_amount
FROM
  order_items;