My sql knowledge is not that good and after 2 hours of brainstorm i decided to ask my fellow friends in here.
Here is my problem, i am developing a travel website. There are regions and prices table. structure is basicly like this.
regions region_contents prices
------- ---------------- --------
regionId regionId priceId
regionName hotelId hotelId
someMoreFields someMoreFields price
beginDate
endDate
someMoreFields
What i want out of this data is
+-----------------+-------------+-------------------------+
| hotelId | hotelName | min price for this Id |
+-----------------+-------------+-------------------------+
| hotelId | hotelName | min price for this Id |
+-----------------+-------------+-------------------------+
| hotelId | hotelName | min price for this Id |
+-----------------+-------------+-------------------------+
| hotelId | hotelName | min price for this Id |
+-----------------+-------------+-------------------------+
I query for all the hotels in spesific region ordered by min price for each hotel and the endDate of price for each hotel should be later than NOW().
Thanks in advance.
Also apoligies for bad grammar.
This query should be what you need: