Oracle 8i
Hi everyone,
I created a View that adds RowNum to an existing table as shown below.
When I join to this new view from another table, I was expecting to get the RANK column for each primary key in the other table that has a one-to-many relationship to this view.
I didn't realize but when joining to this view, the view seems to run first for all records, and then joins to the table. So key 134 might have a rank of 9325.
Is there anyway to get the join to the view to behave as I need? I really need a view I can join to for another tool I am using.
The data needs to look like below.
Hi everyone,
I created a View that adds RowNum to an existing table as shown below.
When I join to this new view from another table, I was expecting to get the RANK column for each primary key in the other table that has a one-to-many relationship to this view.
I didn't realize but when joining to this view, the view seems to run first for all records, and then joins to the table. So key 134 might have a rank of 9325.
Is there anyway to get the join to the view to behave as I need? I really need a view I can join to for another tool I am using.
The data needs to look like below.
Code:
table.Key View.Key View.Code View.RANK
--------- --------- --------- ---------
134 134 ABC 1
134 134 DWF 2
134 134 DRT 3
253 253 KFD 1
253 253 TTA 2
Code:
create or replace view bkb.UWVW_CPT300_ROWID as
SELECT
rownum as RANK
, CPT300_SVC_DIMSN.*
FROM
"BKB"."CPT300_SVC_DIMSN" "CPT300_SVC_DIMSN"
WHERE
"CPT300_SVC_DIMSN"."CPT_CD" <> '.'
AND "CPT300_SVC_DIMSN"."CPT_CD" <> '?'
AND "CPT300_SVC_DIMSN"."CPT_CD" IS NOT NULL
ORDER BY
rownum