Re:SQL or Death? Seminar Series – Spring 2025 – Carnegie Mel...
by cyberax on Sunday February 02, 2025 @07:19PM
(#42913341)
> What do you want to see if there's more than one sale date with the lowest price?
Either one is fine.
PostgreSQL has an extension (DISTINCT ON) that allows to do what I want without subqueries. But standard SQL is simply deficient in this regard, it should be straightforward but it's not.
In any case, you can do this with a subquery and join it with the main table. I don't think there's anything non-standard about it:
I'm sure you can do it with window functions as well.