>>>> 2011/07/29 10:48 +0700, HaidarPesebe >>>> 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. <<<<<<<< What do you mean "total of", and "total qty (USD) pay"? It is better exactly to repeat your code instead of paraphrasing it.
In any case, I get multiples of not three but four, id | periodsmester | qtyone | qtytwo ----+---------------+--------+------- 1 | 2010-2011-1 | 16 | 44 not surprizing since, with these data, all names and semesters and periods the same, it is the same as the sum of an cross join; see how it looks with all grouping & aggregating operations dropped: id | periodsmester | qty | bqty ----+---------------+------+----- 1 | 2010-2011-1 | 2 | 7 1 | 2010-2011-1 | 2 | 4 2 | 2010-2011-1 | 1 | 7 2 | 2010-2011-1 | 1 | 4 3 | 2010-2011-1 | 3 | 7 3 | 2010-2011-1 | 3 | 4 4 | 2010-2011-1 | 2 | 7 4 | 2010-2011-1 | 2 | 4 every pay record is paired with every debt record. If I delete the pay record with id = 4 then I get multiples of three, for the same reason, but with fewer records. Are you sure you got multiples of three with four pay records? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org