Re: Querying for continuous bookings

2003-09-22 Thread Mojtaba Faridzad
well, I am working with mysql for less than 2 months so I may not give you
right answer but I guess we cannot solve this problem without programming.
The point is how to combine the times to have a one POS with continuous
time. this query is an example to combine to records:

SELECT table1.pos, table1.Begings, table2.Ends FROM mytable as table1,
mytable as table2 WHERE table1.pos = table2.pos AND table1.Ends =
table2.Begings ORDER BY table1.pos, table1.Begings, table2.Begings

but this is not working if there are 3 records (or more) which should be
combined together. so if you don't have this case, you can work more on this
query to have the other records and do the search on the final query.


- Original Message - 
From: "Ville Mattila" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 22, 2003 10:56 AM
Subject: Querying for continuous bookings


> Hi there,
>
> My problem at this time is following: I have a table of position
> bookings, having information of a position code, beginning time of the
> booking and end time:
>
> Pos | Begings | Ends
> 
> APP | 2003-09-30 11:00:00 | 2003-09-30 12:15:00
> APP | 2003-09-30 12:15:00 | 2003-09-30 13:00:00
> DEP | 2003-09-30 10:30:00 | 2003-09-30 13:30:00
> ...
>
>
> Now I should make a query that, in some way, gives me an information of
> the positions that are booked without any pause for specified time. For
> example, 2003-09-30 11:00 - 2003-09-30 13:00 should return APP and DEP.
> Anyway, if I queried for period of 2003-09-30 10:30 - 2003-09-30 12:20,
> I should receive only DEP.
>
> Any ideas how to build such a query?
>
> Thanks for information,
> Ville M.
>
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Querying for continuous bookings

2003-09-22 Thread Ville Mattila
Hi there,

My problem at this time is following: I have a table of position 
bookings, having information of a position code, beginning time of the 
booking and end time:

Pos | Begings | Ends

APP | 2003-09-30 11:00:00 | 2003-09-30 12:15:00
APP | 2003-09-30 12:15:00 | 2003-09-30 13:00:00
DEP | 2003-09-30 10:30:00 | 2003-09-30 13:30:00
...
Now I should make a query that, in some way, gives me an information of 
the positions that are booked without any pause for specified time. For 
example, 2003-09-30 11:00 - 2003-09-30 13:00 should return APP and DEP. 
Anyway, if I queried for period of 2003-09-30 10:30 - 2003-09-30 12:20, 
I should receive only DEP.

Any ideas how to build such a query?

Thanks for information,
Ville M.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]