the keep dense rank can always return the result b...
# suiteanalytics
k
the keep dense rank can always return the result based on your sort - your case staement you'd have to know when it was done specifically
g
case when {systemnotes.type} = 'Set' then {systemnotes.newvalue}
would accomplish getting the first value of a field.
k
Assuming that it was logged the first time.
g
Which it isn't always and now I came up with this absolute monstrosity...
DECODE(MAX({linesystemnotes.oldvalue}) KEEP(DENSE_RANK FIRST ORDER BY {linesystemnotes.date}),NULL,MAX({linesystemnotes.newvalue}) KEEP(DENSE_RANK FIRST ORDER BY {linesystemnotes.date}),MAX({linesystemnotes.oldvalue}) KEEP(DENSE_RANK FIRST ORDER BY {linesystemnotes.date}))