i have to sum up most recent record which comments is 'repay principal' and group by deal_id, the following sql is definitly not working, it will sum up all the record include those even not happen yet, after current date. how to do it?
select events.deals_id, sum(cflows_amount)
from events, cflows
group by deals_id
and this one also is not right, it has to be grouped by deals_id.
select events.deal_id, sum(cflows_amount)
from events, cflows
where cflows.date<= CURRENT DATE, cflows.command = 'REPAY PRINCIPAL'
how do i conbine these two together?
hope u could understand my question.
thanks in advance for any help!
select events.deals_id, sum(cflows_amount)
from events, cflows
group by deals_id
and this one also is not right, it has to be grouped by deals_id.
select events.deal_id, sum(cflows_amount)
from events, cflows
where cflows.date<= CURRENT DATE, cflows.command = 'REPAY PRINCIPAL'
how do i conbine these two together?
hope u could understand my question.
thanks in advance for any help!