I haven't seen the previous posts so I'm not sure want you want to do, but
it looks like that you need to specify a join condition. If freerooms.room
and booking.room are the corresponding fields from your table the query
should look something like this

SELECT count(freerooms.room), WEEK(MAX(booking.date),1),
WEEK(MIN(booking.date),1) as total FROM freerooms LEFT JOIN booking ON


SELECT count(f.room),WEEK(MAX(b.date),1), WEEK(MIN(b.date),1)
FROM freerooms f, booking b
WHERE f.room=b.room

Hope this helps
Dobromir Velev

-----Original Message-----
From: Matt Williams <[EMAIL PROTECTED]>
To: Andrey Hristov <[EMAIL PROTECTED]>
Date: Monday, November 19, 2001 10:26
Subject: RE: [PHP-DB] Query help

>This doesn't work either.
>SELECT count(freerooms.room), WEEK(MAX(booking.date),1),
>WEEK(MIN(booking.date),1) as total FROM freerooms LEFT JOIN booking
>> > All good so far
>> > now if I run this
>> > SELECT count(f.room),WEEK(MAX(b.date),1), WEEK(MIN(b.date),1)
>> FROM freero
>> > oms f, booking b;
>> > ->+---------------+---------------------+---------------------+
>> > | count(f.room) | WEEK(MAX(b.date),1) | WEEK(MIN(b.date),1) |
>> > +---------------+---------------------+---------------------+
>> > |         24817 |                  48 |                  40 |
>> > +---------------+---------------------+---------------------+
>> >
>What I have found is
>freerooms.room has 83 rows and booking has 299.
>The value returned for count(f.room) is these two figures multiplied.???
>Why would it do this?
>And how can I get it to return the real value only
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to