Query to Get history rents for Terminated and Expired Contracts.
I'm facing an issue while trying to develop a report to get all contracts with its rents amounts, the below query get accurate rent values for current and active contract when i select a history or inactive contract the query retrieve incorrect rent amounts for all contracts.
I need a help how can i get an accurate rent amounts for Terminated and Expired Contracts?
------------------------------------ Query to get Rents for currents and active contracts ----------
SELECT ose.stream_element_date,
SUM(ose.amount) ,
chrb.CONTRACT_NUMBER,
hzp.party_name,
chrb.sts_code,
chrb.CURRENCY_CODE
FROM okl_strm_elements ose,