In MS Access, there are FIRST and LAST group-by functions where you can return the last value (via natural order, I presume) of columns where other columns are grouped on.
I see MAX and MIN here in Oracle, but nothing like FIRST or LAST. Is there an equivalent?
I have a table that provides no way of determining via the MAX and MIN functions which record is first or last.
Usually, I would say
in order to retrieve the most recent data.
I cannot do this in this case and must rely on natural order. Do you have any suggestions?
Also, if you have any ideas about whether the way I determine the most recent data using MIN and MAX is good or not, I would appreciate that as well.
Many thanks.
-Mike Kemp
I see MAX and MIN here in Oracle, but nothing like FIRST or LAST. Is there an equivalent?
I have a table that provides no way of determining via the MAX and MIN functions which record is first or last.
Usually, I would say
Code:
select m.acct_num,m.comment,m.comment_date
from mytable m,
(select m1.acct_num,max(comment_date) MaxDate
from mytable m1
group by acct_num) sql1
where m.acct_num=sql1.acct_num
and m.comment_date=sql1.MaxDate
I cannot do this in this case and must rely on natural order. Do you have any suggestions?
Also, if you have any ideas about whether the way I determine the most recent data using MIN and MAX is good or not, I would appreciate that as well.
Many thanks.
-Mike Kemp