4
1
I'm looking for some assistance in adding together the output of the two following queries. They have two incompatible conditions so I'm struggling to combine them in the one query.
Total Revenue Year to Date
How to combine the output of both queries?
SELECT
sum(datediff(returndate, dueDate)*(products.rentalfee*0.2)) AS 'Late Fees YTD'
FROM products INNER JOIN orderdetails
ON products.productID = orderdetails.productID
WHERE returndate > duedate
And
SELECT
sum(products.RentalFee*orderdetails.quantity)
AS 'Total Revenue YTD'
FROM products INNER JOIN orderdetails
ON products.productID = orderdetails.productID
WHERE returndate > duedate OR duedate = returndate