I have a table as such:
id, apartment, date, description, amount
I'd like to query it as follows:
select apartment, sum(amount) as balance, max(date), last(description)
from mytable
group by apartment
Of course there is no "last" function. I'm after a list of current balances by apartment showing the last transaction date and description.
Any suggestions?
id, apartment, date, description, amount
I'd like to query it as follows:
select apartment, sum(amount) as balance, max(date), last(description)
from mytable
group by apartment
Of course there is no "last" function. I'm after a list of current balances by apartment showing the last transaction date and description.
Any suggestions?