A
A
Alexey Sklyarov2018-02-27 20:18:24
MySQL
Alexey Sklyarov, 2018-02-27 20:18:24

How to make a selection on a column from some value to the last available?

There is a table:
id,price,last_update
The last_update stores the timestamp time format, I want to select the price by last_update, suppose I have the following data:

+----+-------+-------------+
| id | price | last_update |
+----+-------+-------------+
| 1  | 500   | 1           |
+----+-------+-------------+
| 2  | 300   | 2           |
+----+-------+-------------+
| 3  | 523   | 3           |
+----+-------+-------------+
| 4  | 543   | 4           |
+----+-------+-------------+

How can you select all prices from last_update > 1 to the last last_update (which is 4 in this example)?
CURRENT_TIMESTAMP does not suit me, this last_update is pulled from a third-party API and may differ from the current time, down.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2018-02-27
@0example

Well and select on last_update>1. All others satisfy this condition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question