By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
version() |
---|
5.7.34 |
item_symbol | price | source_date |
---|---|---|
A | 20.10 | 2021-06-10 |
A | 18.20 | 2021-06-11 |
A | 10.90 | 2021-06-13 |
A | 21.00 | 2021-06-15 |
B | 88.20 | 2021-06-10 |
B | 60.90 | 2021-06-11 |
B | 78.16 | 2021-06-13 |
B | 79.00 | 2021-06-15 |
item_symbol | price | source_date | my_rank | @prev := item_symbol |
---|---|---|---|---|
A | 21.00 | 2021-06-15 | 1 | A |
A | 10.90 | 2021-06-13 | 2 | A |
A | 18.20 | 2021-06-11 | 3 | A |
A | 20.10 | 2021-06-10 | 4 | A |
B | 79.00 | 2021-06-15 | 1 | B |
B | 78.16 | 2021-06-13 | 2 | B |
B | 60.90 | 2021-06-11 | 3 | B |
B | 88.20 | 2021-06-10 | 4 | B |
item_symbol | price | source_date | my_rank |
---|---|---|---|
A | 21.00 | 2021-06-15 | 1 |
A | 10.90 | 2021-06-13 | 2 |
B | 79.00 | 2021-06-15 | 1 |
B | 78.16 | 2021-06-13 | 2 |