https://kotlinlang.org logo
#exposed
Title
# exposed
b

Brian Carbone

12/30/2019, 6:39 PM
Copy code
kotlin
SELECT * FROM (
  SELECT DISTINCT ON (address_id) *
  FROM purchases 
  WHERE product_id = 1
  ORDER BY address_id, purchased_at DESC
) t
ORDER BY purchased_at DESC
what is the equivalent of this in exposed?
t

Timur Atakishiev

12/31/2019, 3:09 AM
t

tapac

01/07/2020, 11:35 AM
@Brian Carbone, please look at https://github.com/JetBrains/Exposed/issues/500 for DISTINCT ON expression workaround.
b

Brian Carbone

01/07/2020, 2:01 PM
@tapac I did that, but it's the nested query I had trouble with
101 Views