Gregory Suvalian
Gregory Suvalian

Reputation: 3832

How do I output latest distinct values of specific fields and all other colums?

I need a query which will return all latest entries for specific distinct value of a fields. Example I have table with with 2 columns: ComputerName, date. I want to return all distinct values for ComputerName and latest date for each of them.

Upvotes: 2

Views: 7125

Answers (1)

Yoni L.
Yoni L.

Reputation: 25895

If you only need the maximum date per computer:

table
| summarize max(date) by ComputerName

alternatively, if you need the entire records with latest date per computer:

table
| summarize arg_max(date, *) by ComputerName

Relevant docs:

Upvotes: 6

Related Questions