My table structure is below. The ma_symbol and ma_date are primary keys for this table.
ma_symbol | ma_date | ma
A 2015-03-01 1
A 2016-04-01 2
B 2014-01-01 3
B 2014-02-02 4
For each ma_symbol, I want to pull the rows where ma_date equals max(ma_date). So the result would look like this from the above example:
ma_symbol | ma_date | ma
A 2016-04-01 2
B 2015-02-02 4
I have tried to adapt the following example but it takes far too long to run. This table has 5 million + records.