how to get latest entry of a item when item have multiple rows?

Posted by I Like PHP on Stack Overflow See other posts from Stack Overflow or by I Like PHP
Published on 2010-05-20T07:15:33Z Indexed on 2010/05/27 5:01 UTC
Read the original article Hit count: 162

i have an table

tbl_exp

 id| exp_id|qnty|     last_update
 1 |   12  |  10|2010-05-18 19:34:29
 2 |   13  |  50|2010-05-19 19:34:29
 3 |   12  |  50|2010-05-19 19:34:29
 4 |   15  |  50|2010-05-18 19:34:29
 5 |   18  |  50|2010-05-20 19:34:29
 6 |   13  |  70|2010-05-20 19:34:29

now i need only latest entry of each exp_id

 id| exp_id|qnty|     last_update
 3 |   12  |  50|2010-05-19 19:34:29
 6 |   13  |  70|2010-05-20 19:34:29
 4 |   15  |  50|2010-05-18 19:34:29
 5 |   18  |  50|2010-05-20 19:34:29

please suggest me the mysql query to retrive above result??

thanks!

© Stack Overflow or respective owner

Related posts about mysql-query

Related posts about greatest-n-per-group