Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Problem with limitation of result
Hi,
the following query works as a normal query:
SELECT sc.seccodedesc AS ACCOUNTOWNER, oppsc.seccodedesc AS
OPPORTUNITYOWNER, acc.account, ui.username, opp.description AS OFFERNO, opp.actualclose, opp.reason, opp.estimatedclose, opp.status, opp.actualamount, sod.project_no, opp.actualamount, sod.project_name,sod.category, sod.notes, sod.swisslogprob, sod.projectprob,
FROM opportunity opp, swl_opp_desc sod, seccode sc, seccode oppsc, account acc, userinfo ui
WHERE sod.opportunityid = opp.opportunityid AND opp.seccodeid = oppsc.seccodeid AND acc.accountid = opp.accountid AND acc.seccodeid = sc.seccodeid AND ui.userid = opp.ACCOUNTMANAGERID
but doesn't work as a subquery or a view. i should have this as a subquery, because i want to limit the result using ROWNUM. so i've made the following:
SELECT ROWNUM, oppview.* FROM
(SELECT sc.seccodedesc AS ACCOUNTOWNER, oppsc.seccodedesc AS
OPPORTUNITYOWNER, acc.account, ui.username, opp.description AS OFFERNO, opp.actualclose, opp.reason, opp.estimatedclose, opp.status, opp.actualamount, sod.project_no, opp.actualamount, sod.project_name,sod.category, sod.notes, sod.swisslogprob, sod.projectprob,
FROM opportunity opp, swl_opp_desc sod, seccode sc, seccode oppsc, account acc, userinfo ui
WHERE sod.opportunityid = opp.opportunityid AND opp.seccodeid = oppsc.seccodeid AND acc.accountid = opp.accountid AND acc.seccodeid = sc.seccodeid AND ui.userid = opp.ACCOUNTMANAGERID) oppviewWHERE ROWNUM BETWEEN 0 AND 10 then i get "ORA-00918: column ambiguously defined".
would be great if somebody could explain me what causes that error and how to do that the right way.
thanks
beni
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Tue Jun 29 2004 - 04:22:35 CDT
![]() |
![]() |