thanks, i think your probably right.

Another problem I have is trying to sum the totals of F1 over muliple tables, what I 
would like is to be able to use the UNION statement but my site is hosted and they are 
not using version 4x of MySQL.
Is there any work around for this using a single SQL statement or again will I need to 
use multiple statments and add up the results with php?

thanks again

-----Original Message-----
From: Bastian Vogt [mailto:[EMAIL PROTECTED]]
Sent: 03 February 2003 13:12
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: select from multi tables


> SELECT SUM(T1.F1) AS C1, SUM(T2.F1) AS C2 FROM T1, T2

Hi,

T1,T2 is a join of the two tables which means that you combine each value of T1 with 
each value of T2. This is why you don't get the result you want. In your case I simply 
would do two querys as it won't make any problems:
SELECT SUM T1.F1 FROM T1;
SELECT SUM T2.F2 FROM T2;

Regards,
Bastian


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to