4 messages in com.mysql.lists.win32Re: Query returns the WRONG result
FromSent OnAttachments
ascll07 May 2003 00:10 
Charles Mabbott07 May 2003 04:20 
Bria...@aol.com07 May 2003 10:57 
Bria...@aol.com07 May 2003 14:03 
Subject:Re: Query returns the WRONG result
From:Charles Mabbott (crma@comcast.net)
Date:05/07/2003 04:20:09 AM
List:com.mysql.lists.win32

I have two fields that are 133 and 39

SELECT ( count(lname) + sum(lshow) ) as Total from member;

TOTAL 172 Give this a try

Chuck ============================================= "Incoming rounds always have the right of way" - Rules of War

----- Original Message ----- From: ascll <asc@yahoo.com> Date: Wednesday, May 7, 2003 3:11 am Subject: Query returns the WRONG result

Greetings,

Table_A ======= Field: Amount_A Value: 123.50 78.40 55.65

( SUM( Table_A.Amount_A ) = 257.55 )

Table_B ======= Field: Amount_B Value: 258.50 250.40 651.90

( SUM( Table_B.Amount_B ) = 1160.80 )

Question ======== How to I get the total amount from 2 tables?

I used this query:

SELECT SUM( Table_A.Amount_A ) + SUM( Table_B.Amount_B ) FROM Table_A, Table_B;

The result should be 1418.35, but I got is WRONG result. What wrong with my query?

Thanks in advance and I'm using MySQL ver 4.0.12