How can I get just the first row in a result set AFTER ordering?

前端 未结 4 678
萌比男神i
萌比男神i 2021-01-04 00:38

This gives me just one row (the first one):

SELECT BLA
FROM BLA
WHERE BLA
AND ROWNUM < 2

However, I want the most recent date val; I can

4条回答
  •  感情败类
    2021-01-04 01:13

    This question is similar to How do I limit the number of rows returned by an Oracle query after ordering?.

    It talks about how to implement a MySQL limit on an oracle database which judging by your tags and post is what you are using.

    The relevant section is:

    select *
    from  
      ( select * 
      from emp 
      order by sal desc ) 
      where ROWNUM <= 5;
    

提交回复
热议问题