我想问一下有序表中的一些记录。
select * from table_name order by something desc limit 4;
这是错误消息(是'限制4'行):
ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
Error at Line: 7 Column: 1
答案 0 :(得分:2)
使用ROWNUM
来限制查询返回的行数
http://docs.oracle.com/cd/B28359_01/server.111/b28286/pseudocolumns009.htm#SQLRF00255
select *
(SELECT * FROM table_name ORDER BY someval desc)
WHERE ROWNUM < 5;