Hello all,
I'm trying to write what should be a simple query but is turning out to
be a particularly difficult one and was wondering if I could ask your
advice.
The problem is to do with some harbour management software I'm writing for
a university software course. I have a table which gives the distances (in
metres) along a harbour of the front-end and back-end of where each ship
will dock, and the date and time of when each will arive and depart. What
I am trying to find is the areas of empty space along the harbour between
a given date and time range. So far I have managed to write a query which
returns the occupied spaces (i.e. the positions where ships will be
docked) for a given time range.
A graph of the harbour distance against time looks something like:
0m Distance Along Harbour 1200m
TIME ------------------------------------------
0m->200m 350m->600m 900m->1100m
500m->700
1 XXXXXXX
2 X X
3 X X XXXXXXX XXXXXXXX
4 X X X X X X
5 ???????????????????????????????????????????
6 X XaaaaX X aaaaaaaaaaX Xaaaa
7 XXXXXXXaaaaX X aaaaaaaaaaX Xaaaa
8 aaaaXXXXXXX aaaaaaaaaaX Xaaaa
9 aaaa aaaaaaaaaaX Xaaaa
10 aaaa XXXXXXXaaaaaaaaaaX Xaaaa
11 aaaa X XaaaaaaaaaaX Xaaaa
12 aaaa X XaaaaaaaaaaX Xaaaa
13 ???????????????????????????????????????????
14 X X X X
15 X X XXXXXXXX
16 XXXXXXX
'X' is for the outline of the ship's position over time.
'a' is the area of free space within a given time range that I would like
the query to return.
'?' represents the boundaries the time range I'm checking.
Any white space which doesn't stretch the whole time range is
irrelevant as I need the space for the entire time.
I'm using a table containing (amongst other things):
shipArrivalDate (DATETIME)
shipDepartDate (DATETIME)
startPosition (given in metres from the 0m end of the harbour)
endPosition (given in metres from the 0m end of the harbour)
(These distances are illustrated above)
I can get a table of the start and end positions of all ships in the time
range but converting this into the free space start and end positions has
become a bit of headache.
Any ideas you can give will be much appreciated,
Jamie.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php