I?m creating an invoicing system for a children?s nursery, and I?m trying to work out how I can replicate the thought process one would normally go through when working out the bill for each day. I?ve created all the mysql tables that I think I need, with all the info possible; along the following lines (I?m only showing what?s relevant): Child -> childId, starttime, endtime Fees -> feeId, starttime, endtime, rate (£) The easiest way to explain this is as follows: The nursery fees are broken down into AM (8am to 12.30pm), PM (12.30pm to 6pm) and All Day (8am to 6pm), and furthermore there?s an hourly rate for extras. Child A starts at 9 and finishes at 5 therefore they come under the all day rate Child B starts at 8.30 and finishes at 12pm therefore they come under the AM rate Child C starts at 9.30 and finishes at 1pm, and because it?s not a straight they do AM, PM or All Day, they?ll probably fall under AM, cos it?s including lunch. Can anyone see an easy way of putting that sort of ?human thinking? into a script? Any guidance would be gratefully received? Just to give a bit more background, there are two nurseries (at the moment) and they have different session times, so the fees table does need to have the starttime and endtime. :-( Cheers Nunners