mysql - SELECT SUM(CRC32(column)) LIMIT doesn't work -
i need checksum of specific column , specific number of rows using limit
.
select sum(crc32(column)) table limit 0, 100;
but, value returned checksum of entire table. why happen? how can use limit checksum of specific number of rows?
the following works:
select sum(crc32(column)) table id > 0 , id < 101;
but don't want use method because of potential jumps in auto_increment value.
why happen?
limit
gets applied after aggregate functions.
when used without group by
, sum
aggregates on whole table, leaving 1 record, falls under limit
.
use this:
select sum(crc32(column)) ( select column mytable order id limit 100 ) q
Comments
Post a Comment