我搞定了
like this:
select * from (select rownum as m,a.* from scc_user a) where m between 3 and 8
Top
6 楼dawnzdy(dawn)回复于 2003-04-29 09:37:40 得分 0
楼上的说的对,可这仍是单表查询啊。我自己搞定了。谢谢各位:)
select * from
(select rownum rid,user_id,user_name,user_dept,user_position,user_salary
from
(select info.user_name,salary.*
from zdy_userinfo info, zdy_salary salary
where info.user_id=salary.user_id
order by info.user_id )
) where rid between 1 and 5;
在二层查询中不可用表名,无效,只需用列原名即可。
二层查询中不该有info_id,否则外部的user_id成为未明确定义的列。
我程序中测试的。取前30条,主要oracle没有类似sql server的top
select * from
(
Select a.*, ROWNUM RN From
(SELECT c.customer_code,c.customer_character,c.customer_officer,c.customer_balance,c.customer_creditline,l.*
from loan_fact_loans l left join loan_fact_customer c on l.customer_id = c.customer_id
Order By loans_balance Desc,loans_date Desc ) a
)Where RN <= 30