Skip to content

1831. Maximum Transaction Each Day 👍

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
WITH
  RankedTransactions AS (
    SELECT
      *,
      RANK() OVER(
        PARTITION BY DATE(day)
        ORDER BY amount DESC
      ) AS `rank`
    FROM Transactions
  )
SELECT transaction_id
FROM RankedTransactions
WHERE `rank` = 1
ORDER BY 1;