Complex query with two tables and multilpe data and price ranges

Posted by TiuTalk on Stack Overflow See other posts from Stack Overflow or by TiuTalk
Published on 2010-05-07T20:00:56Z Indexed on 2010/05/07 20:08 UTC
Read the original article Hit count: 231

Filed under:
|

Let's suppose that I have these tables:

[ properties ]
 id (INT, PK)
 name (VARCHAR)

[ properties_prices ]
 id (INT, PK)
 property_id (INT, FK)
 date_begin (DATE)
 date_end (DATE)
 price_per_day (DECIMAL)
 price_per_week (DECIMAL)
 price_per_month (DECIMAL)

And my visitor runs a search like: List the first 10 (pagination) properties where the price per day (price_per_day field) is between 10 and 100 on the period for 1st may until 31 december

I know thats a huge query, and I need to paginate the results, so I must do all the calculation and login in only one query... that's why i'm here! :)

© Stack Overflow or respective owner

Related posts about mysql

Related posts about query