How do I retrieve records from the table using between operator in mysql

advertisements

everybody

I want to retrieve the records from a table(price) based on the following query.My table is

+-----------+
| pprice    |
+-----------+
| 10 lakhs  |
| 11 lakhs  |
| 12 crores |
| 13 lakhs  |
| 15 crores |
| 16 lakhs  |
+-----------+

I'm using the following query

select * from price where pprice between '10 lakhs' and '20 lakhs';

but it returns the following result

+-----------+
| pprice    |
+-----------+
| 10 lakhs  |
| 11 lakhs  |
| 12 crores |
| 13 lakhs  |
| 15 crores |
| 16 lakhs  |
+-----------+

what's the problem in my query.please give me reply for this.


If you're dealing with equal magnitudes, such as lakhs in your example, you can do something like this:

select *
  from price
 where pprice between '10 lakhs' and '20 lakhs'
   and pprice like '__ lakhs';