I have this table:
id|date |x |y
1 |2017-01-01|1 |0
2 |2017-01-01|23|1
4 |2017-01-02|1 |0
I would select the columns x and date, where the grouped row by date have the highest value of y.
In this case i would:
id|date |x |
2 |2017-01-01|23|
4 |2017-01-02|1 |
This table is derived from another join:
X table:
date
2017-01-01
2017-01-02
....
Y table:
from |to |x |y
2017-01-01|2017-01-10|1 |0
2017-01-01|2017-01-05|23|1
X join with Y on date between from and to.
How can I do? Thanks in advance.