O
O
Oleg2021-07-03 20:00:44
SQL
Oleg, 2021-07-03 20:00:44

How can (is it possible) to organize a filter by price?

How is it possible (is it possible?) to organize a filter by price, provided that the cost of the product can be in rubles / dollars / euros, and the user filters the data by one of the currencies. Example, the user is looking for products worth 100 rubles, the database contains products worth $ 100 and 100 euros, the primitive where will find both products, which is not correct. At the moment there are two columns price(int), currency(int).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
ky0, 2021-07-03
@ky0

It is possible, "primitive where" on currency and the price.

A
Antonio Solo, 2021-07-04
@solotony

join to pull up the exchange rate, and then search by product

O
Oxidedixo, 2021-07-04
@Oxidedixo

Kindest!
Add. question - while filtering, you need to display only products with a price indicated in the "filtered" currency, or in any currency, but taking into account the exchange rate at the time of "filtering"?
As ky0 wrote , you can get by with a simple "where", or you can create a view where prices will be indicated in one currency (with conversion to the exchange rate) and already filter products by this view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question