Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaskar_sm
Partner - Creator III
Partner - Creator III

get the Latest records from the table based on the multiple fields

Dear All,

I have one scenario where I need to get the latest records from the tables bases on the following columns.

first need to check for the latest records by checking the maximum of time_stamp, created_at, updated_at against each app_id. so here is the exception we do have some records with duplicated time_stamp, crated_at and updated_at so in that case, we need to take the maximum id for lasted records.   

app_idtime_stampcreated_atupdated_atidstatus
A0019310024402020-05-15 12:12:05.72600727-12-2019 13:4627-12-2019 13:46246410
A0019310024402020-05-15 12:12:06.25300311-12-2019 03:2011-12-2019 03:207451000
A0019930028152020-05-15 12:12:05.72500624-12-2019 11:4924-12-2019 11:49202510
A0019930028152020-05-15 12:12:06.25700816-12-2019 14:5616-12-2019 14:5610911000
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-19 13:14:03.51884819-05-2020 13:1419-05-2020 13:142559710
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 04:39:50.73502119-05-2020 13:1419-05-2020 13:142559715
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 04:39:52.68767819-05-2020 13:1419-05-2020 13:142559720
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 06:00:10.26894619-05-2020 13:1419-05-2020 13:142559730
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 06:00:10.56061819-05-2020 13:1419-05-2020 13:142559740
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 06:00:10.58510719-05-2020 13:1419-05-2020 13:142559750
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 06:00:10.75031619-05-2020 13:1419-05-2020 13:142559750
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 06:00:10.76114519-05-2020 13:1419-05-2020 13:142559760
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 06:00:10.77087719-05-2020 13:1419-05-2020 13:142559770
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 07:01:45.18255619-05-2020 13:1419-05-2020 13:142559780
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 07:04:00.36367219-05-2020 13:1419-05-2020 13:1425597100
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 07:12:41.05740019-05-2020 13:1419-05-2020 13:14255971000
f34a051e-8c32-4ac2-8635-6dcf0af127fc2020-05-20 07:12:47.59047119-05-2020 13:1419-05-2020 13:14255971000

 

the output is highlighted in bold in the above table 

any help is highly applicable 

Thanks,

BK

Labels (5)
0 Replies