PostgreSQL DISTINCT ON dengan ORDER BY yang berbeda

Saya ingin menjalankan kueri ini: SELECT DISTINCT ON (address_id) purchases.address_id, purchases.* FROM purchases WHERE purchases.product_id = 1 ORDER BY purchases.purchased_at DESC Tapi saya mendapatkan kesalahan ini: PG :: Kesalahan: ERROR: SELECT DISTINCT ON ekspresi harus cocok dengan...