Forum Discussion

ramitheeb705's avatar
ramitheeb705
Copper Contributor
May 22, 2023

Materialized view arg_max based on 2 columns

Hey,

if I have a table that has these fields  (key. ,.....,  updated, ingestion_time), I need to build a materialized view that gets the recently updated version for each key, and if there are multiple rows with same key and updated, then I'll take the one with the recent ingestion_time ( from the group that has the recently updated date). is that possible in kusto? it should be a valid materialized view query. 

 

1 Reply

  • pkhalle's avatar
    pkhalle
    Copper Contributor

    ramitheeb705 

    Maybe a bit late, but what you want is probably something like this:

    .create materialized-view [MostRecentlyUpdated] on table [T]
    {
        T | summarize arg_max(ingestion_time, *) by key, updated
    }