php - Get most recent record from MySQL - this have many duplicate records -
php - Get most recent record from MySQL - this have many duplicate records -
i trying fetch recent record db. table looks below.
ticket_id| date| comments ewu-752-84170| 4/10/2015 13:26|bla hcx-943-86125| 4/10/2015 13:39| ola ikw-626-96314| 4/10/2015 13:42| jkj ewu-752-84170| 4/10/2015 13:28| blo ewu-752-84170| 4/10/2015 13:37| ala hcx-943-86125| 4/10/2015 15:11| kbdkj ewu-752-84170| 4/10/2015 13:43| cla
and output should send recent records below.
ticket_id| date| comments ewu-752-84170| 4/10/2015 13:43| cla hcx-943-86125| 4/10/2015 15:11| kbdkj ikw-626-96314| 4/10/2015 13:42| jkj
this select tickets ticket later date not exist (therefore selects latest tickets)
select * mytable t1 not exists ( select 1 mytable t2 t2.ticket_id = t1.ticket_id , t2.date > t1.date )
php mysql sql
Comments
Post a Comment