I have this table for stock prices (simplified version here):
+----------+--------+-------+
|   Time   | Ticker | Price |
+----------+--------+-------+
| 10:00:00 | A      |     5 |
| 10:00:01 | A      |     6 |
| 10:00:00 | B      |     3 |
+----------+--------+-------+
I want to select the row group by Ticker with maximum Time, e.g.
+----------+--------+-------+
|   Time   | Ticker | Price |
+----------+--------+-------+
| 10:00:01 | A      |     6 |
| 10:00:00 | B      |     3 |
+----------+--------+-------+
I know how to do it in SQL, similar question can be found here , but I have no idea how to do elegantly it in KDB.
I have a solution that do selection twice:
select first Time, first Ticker, first Price by Ticker from (`Time xdesc select Time, Ticker, Price from table where date=2018.06.21)
Is there more clean solution?
 
     
    