Bug in Count

From: M. Fenton <cso18_at_keele.ac.uk>
Date: 18 Jul 1993 12:12:55 GMT
Message-ID: <22beo7$dr3_at_gabriel.keele.ac.uk>


I am looking for any information on a problem I am having with the Oracle 'COUNT(*)' in SQL*PLUS VER 6.00.

If I use;

	SELECT COUNT(*),SUM(hours)
	FROM admissions,clinicians
	WHERE admissions.admitted_by=clinicians.clinician
	GROUP BY clinician

I get a count of 36 for a particular clinician and a sum of their hours. However if I use;

	SELECT COUNT(*),SUM(hours/24)
	FROM admissions,clinicians
	WHERE admissions.admitte_by=clinicians.clinician
	GROUP BY clinician

I get a count of 77 for that clinician, all the others are the same. The sum of hours*24 is the same total for that clinician regardless of the count differance.
There are no NULLS, Negatives or zeros in the data-set.

Can anyone suggest a reason why the '/24' is having an effect on the count? Is it something to do with floating point sum? This has also given me some erroneous results in other counts and sums like '202.I5I5I5I5I5I5' for an integer sum.

Thanks in advance for your help.

Mark Fenton
cso18_at_teach.cs.keele.ac.uk Received on Sun Jul 18 1993 - 14:12:55 CEST

Original text of this message