I have one query that contains sales of all items in a date range, and another that contains credits in the same date range.
Almost always the credits are for products for which there are corresponding sales. But sometimes not, where a customer has received credits for products bought earlier than the date range, and there have been no sales of these products in the current date range.
I can use a join type to subtract credits for all products where there have been sales but I'm looking for a way of including the data for credit-only products.
This shows an example of the two queries.
The highlighted credit is without corresponding sale product. The end result I need would start like this but I can only think of complicated ways of getting to this result.
Almost always the credits are for products for which there are corresponding sales. But sometimes not, where a customer has received credits for products bought earlier than the date range, and there have been no sales of these products in the current date range.
I can use a join type to subtract credits for all products where there have been sales but I'm looking for a way of including the data for credit-only products.
This shows an example of the two queries.
The highlighted credit is without corresponding sale product. The end result I need would start like this but I can only think of complicated ways of getting to this result.