Fetch the row which has the Max value for a column on Mysql

by

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 c.barcode,c.statdate,c.count from clientipstat c 
inner join 
(select barcode, max(statdate) as last_statdate
	from clientipstat
	group by barcode) maxt
on (c.barcode = maxt.barcode and c.statdate = maxt.last_statdate)

Some MySQL tools you can try: https://www.withdata.com/mysql/