Greetings, fellow MySQLers!
I know I ain't doing something right, but I don't know what. Say I have a website. It has pages on it that get viewed. The hosting company bills me each day for pages. So..
mysql> select * from bill; +--------+------+ | amount | day | +--------+------+ | 1.10 | mon | | 2.20 | tue | | 3.30 | wed | | 4.40 | thu | | 5.50 | fri | | 6.60 | sat | | 7.70 | sun | +--------+------+ 7 rows in set (0.00 sec)
mysql> select * from pageviewed; +----------+------------------+ | page | totaltimesviewed | +----------+------------------+ | example1 | 4 | | example2 | 1 | | example3 | 4 | | example4 | 2 | | example5 | 1 | +----------+------------------+ 5 rows in set (0.00 sec)
mysql> select sum(amount) from bill; +-------------+ | sum(amount) | +-------------+ | 30.80 | +-------------+ 1 row in set (0.01 sec)
mysql> select sum(totaltimesviewed) from pageviewed; +-----------------------+ | sum(totaltimesviewed) | +-----------------------+ | 12 | +-----------------------+ 1 row in set (0.00 sec)
So far so good...but when I do this query, I get this result:
mysql> select sum(amount), sum(totaltimesviewed) from bill, pageviewed; +-------------+-----------------------+ | sum(amount) | sum(totaltimesviewed) | +-------------+-----------------------+ | 154.00 | 84 | +-------------+-----------------------+ 1 row in set (0.00 sec)
Why don't I get "30.80" and "12"? How can I change the query so I do get that result? What in the world did I actually do to get "154.00" and "84"? I can't see how anything adds up to those numbers...
TIA for all help!
--Kevin
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]