Tag: MAX() + GROUP BY
-
Fetch the row which has the Max value for a column on Mysql
I have a MySQL table clientipstat, 3 columns: barcode, statdate, count. I want to get the latest row for each barcode(1 result per unique barcode), like this: barcode statdate count 1525020018 2013/5/9 1 1505080034 2013/5/11 1 6205020011 2013/5/15 1 6205020026 2013/5/17 1 6205030040 2013/5/18 2 I use MAX() + GROUP BY to do this: select…