Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
It would be nice if FIRST_VALUE() was also usable in non-window form as
FIRST_VALUE(expr,[expr,...])
where it would evaluate all arguments in order, and return the first one. This is both for the obvious symmetry with LAST_VALUE(), but also because sometimes it's more natural to write the expression you want to return first, e.g.
SELECT a, b, c, FIRST_VALUE(d, @var1:=e, @var2:= f) FROM table;
as opposed to:
SELECT a, b, c, LAST_VALUE(@var1:=e, @var2:= f, d) FROM table;
I realize this is basically cosmetic and doesn't actually add any functionality, but it would be nice to have nonetheless, and I imagine it'd be very simple to implement.