I m having trouble writing a query, I have two tables.
-
Property Table (property)
- id
- property_name
- property_type
- price
there are two types of property, commercial or residential. If type is residential the price is for whole property. But if the type is commercial, each flat have different prices, like Ground Floor, 1st floor, 2nd floor, 3rd floor. and so on. So i made a second table
-
Property Price Table (price_for_commerical_prop)
which has following fields- id
- property_id
- floor_id
- price
this table may contain multiple row for one property, depending upon the number of flats the property has. floor_id contains value 0 for ground floor, 1 for 1st floor and so on.
My problem is that. I have a search field to search property based on price. So If user enters price, i have to search price in price field of 1st table as well as 2nd table. And return the rows based on the search criteria. Can anybody shed light on how to do this?
To search for a price range of 10 to 20, you could:
The
casereturns the price fromPropertyfor residential, and the price fromprice_for_commerical_propfor commercial.