We keep a timecard database and I was just asked how much time had been charged to a 
particular project code.  No problem says I and did the following:

select sum(worktime) from timecard where tcacct=project;

The answer came back 182.  Then I was asked who had spent time on the project.

the query was:

select sum(worktime),user from timecard where tcacct=project group by user;

the answer was:

8.00    user1
14.00   user2
160.00  user 3

Now, where I went to school, this adds up to 184!

Suggestions?



>Submitter-Id:  <submitter ID>
>Originator:    Bruce Ferrell
>Organization:
 
>MySQL support: none 
>Synopsis:      incorrect result from sum() function
>Severity:       critical 
>Priority:       high
>Category:      mysql
>Class:         
>Release:       mysql-3.23.38 (Source distribution)
>Server: /usr/local/mysql/bin/mysqladmin  Ver 8.20 Distrib 3.23.38, for pc-linux-gnu 
>on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          3.23.38-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 57 days 22 hours 54 sec

Threads: 7  Questions: 2503729  Slow queries: 175857  Opens: 11226  Flush tables: 1  
Open tables: 64 Queries per second avg: 0.500
>Environment:
System: Linux romulus.microdisplay.com 2.2.19 #3 Fri Apr 6 10:33:27 PDT 2001 i686 
unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Compilation info: CC='gcc'  CFLAGS=''  CXX='c++'  CXXFLAGS=''  LDFLAGS=''
LIBC: 
lrwxrwxrwx    1 root     root           13 Sep 29  2000 /lib/libc.so.6 -> libc-2.1.3.so
-rwxr-xr-x    1 root     root      4101836 Jan 15  2001 /lib/libc-2.1.3.so
-rw-r--r--    1 root     root     20273324 Jan 15  2001 /usr/lib/libc.a
-rw-r--r--    1 root     root          178 Jan 15  2001 /usr/lib/libc.so
Configure command: ./configure  --prefix=/usr/local/mysql
Perl: This is perl, version 5.005_03 built for i386-linux

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to