database - Comparing Price range in mysql -
working on real estate site user can search property based on minimum , maximum price. in database have fields property_price_maximum , property_price_minimum, both set int.
these 2 combo boxes user enter values.
min max 5 lacs 25 lacs 25 lacs 50 lacs 50 lacs 70 lacs 70 lacs 1.5 cr 1.5 cr 5 cr note: lacs = lakh , cr = crore. (100 lacs = 1crore) [added info]
for ints tried this:
select property_price_min,property_price_max properties (property_price_min between 25 , 55) , (property_price_max between 25 , 55); works corrrectly,but when there crore value 1.5 fails have not entered units in database.
when changed fields in database varchar , tried similar query units results not correct(obviously because between compares numerals per knowledge)
select * properties inner join cities on properties.city_id=cities.city_id inner join locality on properties.locality_id=locality.locality_id (cities.city_name '%".$citysearch."%' , locality.locality_name '%".$localitysearch."%') , (property_price_min between '78 lacs' , '80 lacs'); i want properties min , max price between users range.the problem units on here bcoz if user selects 25 lacs , 1.5 cr query wont return correct.
i don't think option far numbers concerned .
kind of helpful comments appreciated.
you should store values "lacs". since 100 lacs = 1 crore, should store 1.5 crore 150 lacs, , calculations in lacs.
Comments
Post a Comment