sql - MySQL Select Duplicated Data By The Latest Update Time -


i got question mysql query. here problem. have table structure.

categoryname | checkindate | checkoutdate | roomprice | roomservice | inserttime.         | updatetime cat1         | 2015-05-12  | 2015-05-13   | 300,000   | breakfast   | 2015-05-13 12:33:21 | 0-0-0 00:00:00 cat1         | 2015-05-12  | 2015-05-13   | 320,000   | wifi        | 2015-05-13 12:33:22 | 0-0-0 00:00:00   cat1         | 2015-05-12  | 2015-05-13   | 350,000   | breakfast   | 2015-05-13 12:33:22 | 2015-05-13 12:36:12     cat1         | 2015-05-12  | 2015-05-13   | 390,000   | wifi        | 2015-05-13 12:33:22 | 2015-05-13 12:36:33 

how can obtain latest updated data :

cat1 | 2015-05-12 | 2015-05-13 | 320,000 | breakfast | 2015-05-13 12:33:22 | 2015-05-13 12:36:12     cat1 | 2015-05-12 | 2015-05-13 | 320,000 | wifi      | 2015-05-13 12:33:22 | 2015-05-13 12:36:33 

but noted, newest list of updated cat1 not in same amount previous updated cat1.

how can achieved this.

i have tried query :

select distinct *    mytable   hotel_id = 1  

and

select *    mytable   hotel_id=1  ,    in         (                select max(updatetime)                  mytable) 

but unfortunately, both of them doesn't fulfilled requirement.

any idea guys? in advance...

try :

select    categoryname,    checkindate,    checkoutdate,    roomprice,    roomservice,    inserttime,    updatetime    mytable  hotel_id=1     , updatetime not null order updatetime asc 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -