hiveql - Hive Query to get the last record inserted in the table -


                date             time         b 35573407        20170412        140930  310260453908912 35573407        20170412        140930  310260453908912 35573407        20170412        141054  310260453908912 35573407        20170412        025339  310260453908912 35573407        20170412        072918  310260453908912 35573407        20170412        091105  310260453908912 35573422        20170412        193605  310260453908912 35573407        20170412        121105  310260453908912 35573407        20170412        032439  310260453908912 35573407        20170412        032605  310260453908912 

i trying figure out hive query last record inserted in table b. records need sorted time column , last record. suppose in above records

35573422  20170412  193605  310260453908912 

is last record.

select  a,date,time,b    (select  *                ,row_number() on                  (                     partition    b                     order        date desc                                    ,time desc                 ) rn             mytable         ) t    t.rn = 1 

+----------+----------+--------+-----------------+ |        |   date   |  time  |      b          | +----------+----------+--------+-----------------+ | 35573422 | 20170412 | 193605 | 310260453908912 | +----------+----------+--------+-----------------+ 

Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -