Bug #9874 | AVG() on a datetime/timestamp does not return expected values | ||
---|---|---|---|
Submitted: | 13 Apr 2005 15:43 | Modified: | 14 Apr 2005 11:35 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.11 rpm | OS: | Linux (RHEL 3 update 4) |
Assigned to: | CPU Architecture: | Any |
[13 Apr 2005 15:43]
[ name withheld ]
[13 Apr 2005 21:40]
Jorge del Conde
Tested w/4.1 from bk
[14 Apr 2005 11:35]
Sergei Golubchik
This is not a bug. AVG() expects a numeric argument. And when a date, e.g. "2005-04-04 13:31:16" is converted to a number you get 20050404133116. Computing the average for these numbers makes little sense :) Using UNIX_TIMESTAMP/FROM_UNIXTIME is the correct solution, To let MySQL average dates correctly is a valid suggestion, but implementing it is not a bugfix. Feel free to reopen the report, changing the severity to S4 - "feature request".