I will try to explain my problem as much as I can.
I have a search form where user can select different parameters and enter different values to perform a search for the properties. Like I have a table tbl_properties.
In search form user selects, property_category, property_type [a lease, sale or rent], inputs price range, no_of_bedrooms, location,districts, property_area, etc. The property attributes may be in tbl_properties or in other lookup tables. Writing query is not my problem, but the problem I m in is, I want to sort records in following pattern in search results
- First show result – price that matched the location in descending order
- Then show – price that matched the district
- Then show – No of bedrooms match in same district
- Then show – Price/bedrooms/property area matched but in different district
I just want a hint how can the records be sorted in these orders?
EDIT
Here is the brief description of the table structure I have
tbl_properties
-------------------
property_id INT
category_id INT
property_name VARCHAR
price INT
district_id INT
location VARCHAR
property_type ENUM('lease','sale','rent')
tbl_category
-------------
category_id INT
category_name VARCHAR
tbl_districts
-----------------
district_id INT
district_name VARCHAR
tbl_property_details
------------------------
detail_id INT
property_id INT
no_of_bedrooms INT
property_area DECIMAL
Thanks
1 Answer