MYSQL group by and order by query


#1

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.

Thanks
Abhi


#2

On Oct 10, 9:57 pm, “Abhishek shukla” removed_email_address@domain.invalid wrote:

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

Thanks
Abhi

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