Query which gives a running total

T

Travis

I've got a "portfolios" table which contains transactions of various
investments. There is also an "investors" table and a "Investments"
table.

The transactions table holds lots of records of buys and sells.

I want to output the total amount invested in a particular asset. If
the output is zero, because the position has now been closed, I don't
want it to show at all, otherwise I want the cost base, number of units
and position value fields all summed.

And a slightly different query: I want to run another query which only
outputs the IDs of the investments held without worrying about the
amounts. How do I get a unique (no duplicates) list of records?

Thanks!

Travis
 
Top