In a mysql db, I have two tables:

**prices** - iid, trade\_date, price

**trades** - iid, trade\_date, nominal, price

I am trying to create an aggregated, cumulative series with the dates from prices and the values calculated as sum(trades.nominal\*prices.price) but nothing comes out the way I want.

[SQL Fiddle 1](http://sqlfiddle.com/#!9/a799b6/3 "SQL Fiddle 1")

[SQL Fiddle 2](http://sqlfiddle.com/#!9/d4a6d3/3 "SQL Fiddle 2")

This is what I want to achieve:

[![enter image description here](https://i.stack.imgur.com/Qcbj9.png)](https://i.stack.imgur.com/Qcbj9.png)

Any help greatly appreciated!

PS. Had a typo. It said value = trades.nominal \* trades.prices...it should be trades.nominal \* prices.price.