Skip to content

Commit

Permalink
AVG(ts) worked in MySQL 4.0, returning a value that could be inserted
Browse files Browse the repository at this point in the history
directly into a datetime column, but not in 4.1 where it returns
a floating point value that gets inserted into a datetime column as
0000-00-00.  So we have to be a little more precise in specifying what
we want.
  • Loading branch information
jamiemccarthy committed Aug 3, 2005
1 parent fdf3894 commit 79322b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Slash/DB/Static/MySQL/MySQL.pm
Expand Up @@ -1230,7 +1230,7 @@ sub fetchEligibleModerators_accesslog_insertnew {
return if $lastmaxid > $newmaxid;
my $ac_uid = getCurrentStatic('anonymous_coward_uid');
$self->sqlDo("INSERT INTO accesslog_artcom (uid, ts, c)"
. " SELECT uid, AVG(ts) AS ts, COUNT(*) AS c"
. " SELECT uid, FROM_UNIXTIME(FLOOR(AVG(UNIX_TIMESTAMP(ts)))) AS ts, COUNT(*) AS c"
. " FROM accesslog"
. " WHERE id BETWEEN $lastmaxid AND $newmaxid"
. " AND (op='article' OR op='comments')"
Expand Down

0 comments on commit 79322b9

Please sign in to comment.