Re: Query help
| From: | Andrey Hristov | Date: | Fri, 16 Nov 2001 15:32:13 +0000 |
| Subject: | Re: Query help | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14398@lists.php.net to get a copy of this message | ||
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" <matt@yewlands.com>
To: "Php-Db@Lists. Php." <php-db@lists.php.net>
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: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>