jaigan1979,
OK here goes,
The goal is to return a unique Band refernce for each supplier (only 1 band per supplier). The band value is then used to query a rates table later on.
The pickUpDate is the start date chosen by the user (they are hiring a car)
the bkgDate is the date of the booking (the current date as they will be booking online)
The idea is we can set pick up date range periods which we can use to control the rates (different rates for different times of the year) - you will notice that no pickUpDate ranges (between pickUpStart and pickUpEnd) overlap for any one supplier
the bkgDateRanges allow us to run short term rate changes at various points of the year. You will notice that the bulk of these date ranges are the same (bkgDateStart - bkgDateEnd). This only really comes into play when the booking date (current date) falls inside one of the short term rate change periods. rowID 8 is a good example of this and represents a rate change wich only applies to bookings made between the 4th and 6th January 2005.
So the logic is as follows:
Find the closest pickUpDate range matches for all suppliers
then
filter down to closest bkgDateRange match for each supplier (if we are in a short term rate change period the correct row will superceed all others)
Basically that's as far as I've got. The statement orders the results so that the correct row for each supplier ID is on top (i.e. it's the first row for that supplier ID that I want). I now need to fileter out the non-relevant rows.
Does that make sense?
PJORDANNA
Main Topics
Browse All Topics





by: jaigan1979Posted on 2005-01-04 at 07:03:43ID: 12952600
Since the query is from only one table, there must be a simpler way...
can you explain your question once again (not in the same way as you did earlier...becos i didnt get it)
hope i can help
Regards
Jag