MySQL Forums
Forum List  »  MyISAM

SUM, strange results
Posted by: Domen Cesnik
Date: January 13, 2006 08:53AM

Helo,

I have a problem with query
SELECT SUM(r.cena) AS cena,r.kartica,o.naziv2,o.id FROM `helios_osebe` o, `helios_racuni` r where o.kartica=r.kartica GROUP BY kartica ORDER BY cena DESC

Where helios_osebe is
CREATE TABLE `helios_osebe` (
`naziv` int(11) NOT NULL default '0',
`naziv2` varchar(100) NOT NULL default '',
`naslov` text NOT NULL,
`posta` int(11) NOT NULL default '0',
`drzava` varchar(100) NOT NULL default '',
`tel` varchar(100) NOT NULL default '',
`mob` varchar(100) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`davcna` varchar(100) NOT NULL default '',
`spol` tinyint(4) NOT NULL default '0',
`rojstvo` date NOT NULL default '0000-00-00',
`kartica` int(11) NOT NULL default '0',
`prvaprijava` tinyint(1) NOT NULL default '0',
`sprememba` tinyint(4) NOT NULL default '0',
`id` int(11) NOT NULL default '0'
) TYPE=MyISAM;

and helios_racuni
CREATE TABLE `helios_racuni` (
`kartica` int(11) NOT NULL default '0',
`kljuc` varchar(100) NOT NULL default '0',
`datum` date NOT NULL default '0000-00-00',
`vrednost` float NOT NULL default '0',
`zaplacilo` float NOT NULL default '0',
`popust` float NOT NULL default '0',
`ident` varchar(100) NOT NULL default '',
`naziv` varchar(100) NOT NULL default '',
`kol` int(11) NOT NULL default '0',
`em` varchar(100) NOT NULL default '',
`cena` float NOT NULL default '0',
`davek` float NOT NULL default '0',
`id` int(11) NOT NULL default '0'
) TYPE=MyISAM;

There are 286 records in helios_racuni and 1426 records in helios_osebe

Results i sometime get are like
100000 100287 Naziv1 70
104055 100573 Naziv2 1122
100000 100671 Naziv3 1180
10000 100823 Naziv4 1177
10000 101436 Naziv5 1342
10000 100559 Naziv6 1152
10000 100907 Naziv7 1159
10000 100620 Naziv8 1149

Problem is that the first colum is not calculated right.
Sometimes the results are corect.
On test server with same MySQL and same data i don't have any problems. But on hosting server of hosting company this shi** is coming out.

Are there any common problems with that, i could report to hosting company, becouse they say that they can't do anything.

Version of MySQL is 4.0.25

Thank you for helping me.
Domen

Options: ReplyQuote


Subject
Views
Written By
Posted
SUM, strange results
3858
January 13, 2006 08:53AM
2063
January 16, 2006 05:21AM
2054
January 18, 2006 10:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.