5 樓bjshasha(傻傻)回複於 2003-04-28 17:54:05 得分 0
我搞定了
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