SELECT count(f.room),WEEK(MAX(b.date),1), WEEK(MIN(b.date),1) FROM freero oms f, booking b;
will be SELECT count(f.room),WEEK(MAX(b.date),1), WEEK(MIN(b.date),1) FROM freero oms f LEFT JOIN booking USING(room) b; room is the field which connects two tables. If it has different name change it in USING Other problems? Write.. Regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS ----- Original Message ----- From: "Matt Williams" <[EMAIL PROTECTED]> To: "Php-Db@Lists. Php." <[EMAIL PROTECTED]> Sent: Friday, November 16, 2001 5:20 PM Subject: [PHP-DB] Query help > Not really this list but I'm after a quick bit of help. > If I run this query > > select count(room) from freerooms; > ->83 > > and this > > SELECT WEEK(MAX(date),1), WEEK(MIN(date),1)as totalweeks FROM booking; > ->48 40 > > 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 | > +---------------+---------------------+---------------------+ > > It seems to be mulitplying out for some reason but I'm stuck as to how/why > and how to resolve it. > > TIA > > M: > > > -- > 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]