From: shaun thornburgh [mailto:[EMAIL PROTECTED]
> Hi,
>
> The following query works out the amount of hours a user has
> been booked for on a particular day:
>
> SELECT
> (SUM(((DATE_FORMAT(B.Booking_End_Date, "%k") * 60 ) +
> DATE_FORMAT(B.Booking_End_Date, "%i")) -
> ((DATE_FORMAT(B.Booking
Shaun
Not a 100 % sure if this is what you're looking for or if somebody's already
suggested it also do not know how practical it is for your application
If a booking spans more than one day (e.g. two) split it into two days - and
write two records to the table one for each daythis fi
I'm under the impression that your over thinking the problem.
LOOK-UP the functions DATE_SUB / INTERVAL / TIME_TO_SEC / TO_DAYS and
the arithmetic should be easy.
- Dathan Vance Pattishall
- Sr. Programmer and mySQL DBA for FriendFinder Inc.
- http://friendfinder.com/go/p40688
-->-Or
On Wed, 2003-10-08 at 09:52, shaun thornburgh wrote:
> Hi,
>
> I have a table called Bookings which has two important columns;
> Booking_Start_Date and Booking_End_Date. These columns are both of type
> DATETIME. The following query calculates how many hours are available
> between the hours of 09
s one is my .02... :-)
-Original Message-
From: shaun thornburgh [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 3:51 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Help With a DATETIME Query
Thanks for your reply, but its not an option!
>From: "Dan Greene&q
Thanks for your reply, but its not an option!
From: "Dan Greene" <[EMAIL PROTECTED]>
To: "shaun thornburgh" <[EMAIL PROTECTED]>,
<[EMAIL PROTECTED]>
Subject: RE: Help With a DATETIME Query
Date: Tue, 7 Oct 2003 16:41:04 -0400
I know it's not the a
I know it's not the answer you're looking for... :( but dealing with overnights has
caused me so much aggravation in past apps I've written, I've tended to make the
client create two (or more) 'bookings' for the covered time... don't know if it's an
option for you, but it's my $0.02.
> -
Hi,
I would do this in the application layer something like this:
$list_of_days_you_want_to_look_at = ('mon','tue','wed'..); Foreach ($day
in $list_of_days_you_want_to_look_at) {
use a similar query to below but geared to only look at $day instead; }
You should get an output like this:
Hi,
I would do this in the application layer something like this:
$list_of_days_you_want_to_look_at = ('mon','tue','wed'..);
Foreach ($day in $list_of_days_you_want_to_look_at) {
use a similar query to below but geared to only look at $day instead;
}
You should get an output like this: