Note that there are some explanatory texts on larger screens.

plurals
  1. POsorting search results in custom criteria
    primarykey
    data
    text
    <p>I will try to explain my problem as much as I can.</p> <p>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 <code>tbl_properties</code>. </p> <p>In search form user selects, <code>property_category</code>, <code>property_type</code> [a lease, sale or rent], inputs price range, <code>no_of_bedrooms</code>, <code>location</code>,<code>districts</code>, <code>property_area</code>, etc. The property attributes may be in <code>tbl_properties</code> 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</p> <ol> <li>First show result - price that matched the location in descending order</li> <li>Then show - price that matched the district</li> <li>Then show - No of bedrooms match in same district</li> <li>Then show - Price/bedrooms/property area matched but in different district</li> </ol> <p>I just want a hint how can the records be sorted in these orders?</p> <p><strong>EDIT</strong></p> <p>Here is the brief description of the table structure I have</p> <pre><code>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 </code></pre> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload