M
M
Mikhail Ksenofontov2022-03-14 17:45:33
PostgreSQL
Mikhail Ksenofontov, 2022-03-14 17:45:33

BETWEEN operator for a range of values?

Good day to all.

The question is about the BETWEEN operator (or an alternative)
The task is to find the price close_price in the percentage range of prices open_price
Here is the table:
622f543990bc4300434565.png

For obvious reasons, the query does not work:

SELECT * FROM table
WHERE close_price BETWEEN 
(select ((open_price * 0.10) + open_price) from table)
AND
(select (open_price - (open_price * 0.10)) from table);

Who can suggest an alternative way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2022-03-14
@KsenoLv

close_price between open_price * 0.9 and open_price * 1.1

do you mean a simple math operation?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question