Get The Latest values For Same ID/Duplicate ID ----------------I Want To Show Only Red marked product_id,on_hand,created_at, In this image Product_id have same Duplicate id but i want only last entry or latest product_id information and Show if last entry value is zero .
Try this:

SELECT primary_table.product_id, primary_table.on_hand, primary_table.created_at 
     FROM 
`table_name` primary_table, 
(SELECT MAX(purchase_id) as pId FROM `table_name` Group by product_id) second_table 
     where primary_table.purchase_id = second_table.pId