V
V
Vasily G.2015-09-25 14:33:07
MySQL
Vasily G., 2015-09-25 14:33:07

How to do a field search if the field value is a range?

Hello.
The database has a price column - a varchar type field, where approximately the following values ​​are stored
: 1. NULL
2. 100
3. 5000
4. 100-250 - range (there are problems with it)
I need to do a search, find all records where the price is higher 50 (should show 2-4)
or find everything where the price is between 100 and 500 (should show 2, 4)
How do I search in a range? Is it possible to split a value by "-" character in MySQL ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max, 2015-09-25
@hebrian_vasyl

1. kill your DBA
2. redo the table - enter price_min and price_max.
The first item is required, the second is optional.

M
Melkij, 2015-09-25
@melkij

Divide by two normal ints (or decimal if you need fractional ones)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question