List:General Discussion« Previous MessageNext Message »
From:HaidarPesebe Date:July 29 2011 3:48am
Subject:results from a total of always amount to a multiple of 3
View as plain text  
I experienced a unique problem, after I call the database as follows:

SELECT id, concat(period,'-',semester) as periodsmester, sum(qty) as qtyone, sum(bqty) as
qtytwo FROM pay a INNER JOIN debt b on (a.name=b.uname AND a.period=b.bperiod AND
a.semester=b.bsemester) WHERE name='jon' group by concat(period,semester) order by period
ASC, semester ASC

but results from a total of always amount to a multiple of 3.
should total qty (USD) pay = 8 but the result would be 24. so also for the Debt.

Please help.

Such databases

DB 1 = pay

id | name | period          | semester | qty(USD)
----------------------------------------------------------------
1  | jon    |  2010-2011   |  1          |  2
2  | jon    |  2010-2011   |  1          |  1
3  | jon    |  2010-2011   |  1          |  3
4  | jon    |  2010-2011   |  1          |  2


DB 2 = Debt

did | uname | bperiod        | bsemester | remark | bqty(USD)
---------------------------------------------------------------------------------
1  | jon     |  2010-2011    |  1        |      paper    |   7
2  | jon     |  2010-2011    |  1        |      mouse  |   4


Thanks,
Haidarpesebe


__________ Information from ESET NOD32 Antivirus, version of virus signature database 6333
(20110728) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


Thread
results from a total of always amount to a multiple of 3HaidarPesebe29 Jul
  • Re: results from a total of always amount to a multiple of 3hsv30 Jul
Re: results from a total of always amount to a multiple of 3HaidarPesebe1 Aug
  • Re: results from a total of always amount to a multiple of 3hsv2 Aug