Skip to content
Advertisement

SQL – How to get only current and previous value for each ID

I have a table

Want to get ID and value of current (latest) and previous date:

So far I have some parts but need only 1 ID per row (this bellow give more than 1 row for each ID – it will show for 5/20 date in the next row for the same ID which is wrong):

How to achieve that?

Advertisement

Answer

you can try like below

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement