results from a total of always amount to a multiple of 3

results from a total of always amount to a multiple of 3

am 29.07.2011 05:48:27 von HaidarPesebe

------=_NextPart_000_0018_01CC4DDD.0C711330
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=3Db.uname AND a.period=3Db.bperiod AND a.semester=3Db.bsemester) =
WHERE name=3D'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 =3D 8 but the result would be 24. so also for =
the Debt.

Please help.

Such databases

DB 1 =3D 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 =3D 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 signatur=
e database 6333 (20110728) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


------=_NextPart_000_0018_01CC4DDD.0C711330--

Re: results from a total of always amount to a multiple of 3

am 29.07.2011 15:48:32 von (Halász Sándor) hsv

>>>> 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=gcdmg-mysql-2@m.gmane.org

Re: results from a total of always amount to a multiple of 3

am 01.08.2011 04:48:50 von HaidarPesebe

------=_NextPart_000_0040_01CC5030.379118D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Exactly what you are saying Mr. S=E1ndor. I tried adding a recordamount =
of debt then becomes a multiple of 4. Well I'm really confused. Are =
there any who can help? how to call the databaseby entering on the =
right?

----- Original Message -----=20
From: HaidarPesebe=20
To: MySQL Lists=20
Sent: Friday, July 29, 2011 10:48 AM
Subject: results from a total of always amount to a multiple of 3


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=3Db.uname AND a.period=3Db.bperiod AND a.semester=3Db.bsemester) =
WHERE name=3D'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 =3D 8 but the result would be 24. so also =
for the Debt.

Please help.

Such databases

DB 1 =3D 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 =3D 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


__________ Information from ESET NOD32 Antivirus, version of virus =
signature database 6339 (20110731) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signatur=
e database 6339 (20110731) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


------=_NextPart_000_0040_01CC5030.379118D0--

Re: results from a total of always amount to a multiple of 3

am 01.08.2011 15:04:32 von (Halász Sándor) hsv

>>>> 2011/08/01 09:48 +0700, HaidarPesebe >>>>
Exactly what you are saying Mr. Sándor. I tried adding a recordamount of debt then becomes a multiple of 4. Well I'm really confused. Are there any who can help? how to call the databaseby entering on the right?
<<<<<<<<
What do you want from the joint? That is not clear. It is clear only that it allows too many combinations.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org