Pat, I think it might be caused by the fact that you are grouping by a column that isn't being selected - ordini.numordine is not in the select part.
Andy > -----Original Message----- > From: PaT! [mailto:[EMAIL PROTECTED] > Sent: 26 June 2003 12:50 > To: [EMAIL PROTECTED] > Subject: sum() problems > > > Dear All, > > I have this two queries > > The first one gives me the right result for the sum(): > > SELECT DATE_FORMAT(ordini.dataord,'%d-%m-%Y'), > SUM(ordini.totale), > SUM(ordini.quantita), > ordini.codcliente, > ordini.fromprev > FROM ordini > WHERE ordini.numordine = 2302 > GROUP BY ordini.numordine; > > > this other one gives me problems with the sum(), wrong result. > > SELECT DATE_FORMAT(ordini.dataord,'%d-%m-%Y'), > SUM(ordini.totale), > SUM(ordini.quantita), > ordini.codcliente, > ordini.fromprev, > carello.numprev, > DATE_FORMAT(carello.dataordine,'%d-%m-%Y') > FROM ordini, carello > WHERE ordini.numordine = 2302 > AND carello.numprev = ordini.fromprev > GROUP BY ordini.numordine, carello.numprev; > > Help is appreciated > > I'm using mysql 4.0.13 > > Patrizio > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]