回 帖 发 新 帖 刷新版面

主题:如何访问数据表 top n 条记录?

ASP 访问 前 10条记录是
select top 10 * from tb1

JSP 这样写是不显示的,请问JSP 是怎样写?

回复列表 (共4个回复)

沙发

SQL statements are only different from database to database, has nothing to do with JSP or ASP.

If you are using the same database, you meight made mistakes somewhere else.

Just a guess.

板凳

For exampel, in Oracle you need to use the following to do the same thing

SELECT *

FROM (SELECT column_names

FROM table_name

ORDER BY column_name DESC)

WHERE ROWNUM <= 10

3 楼

"select * from (select b2name from b2 order by id desc ) where ROWNUM <= 10";

显示     参数不足,期待是 1。
不明白~~  

4 楼

Hey, I don't have an Oracle to test on hand, I got it from internet. However, the original is 1, I was not sure why.

Try 1 to see what happens.

[b]"select * from (select b2name from b2 order by id desc ) where ROWNUM <= 1";[/b]

Let me know.

我来回复

您尚未登录,请登录后再回复。点此登录或注册