MYSQL group by and order by query

Hello friends,

i need to get the latest record of same field

for e.g

there is a table called xyz and it contains the following field item_id, created_at

so i want a single record for every similar item_id whose created_at is the latest.

i tried group by with order by but no success, Please help me with proper query.



Xyz.maximum(:created_at, :group => :item_id)