Hi
I would like to create a query from two tables to calculate a value
Table 1: Sales
Column: Sales_amount
Table 2: Returns
Column: Return_amount
So I would like to create a query that returns the percentage return ratio where the percentage ratio is Sum(Return_amount) / (Sales_amount) and also being able to filter the query by dates.
Can I do this in a single SQL Query or Do I need to do a PL/SQL code
I would like to create a function where I can send the two dates range and receive the percentage.
What is the best way to do it?
Thanks for any help on this!