Hi
I know this is a really elementary question, but I keep getting caught out by it.
I've got one view where it lists some stuff
SQL> select * from v_ins_ents_oustanding;
INSID INSNAME OUTSTANDING
---------- ------------------------------ -----------
101 MS8 17
102 MS9 0
I've got another view which contains some more information
SQL> select insid from v_monitored_procs;
INSID
----------
102
102
What I'd like to do is make a third view, which essentially contains v_ins_ents_oustanding, but with an extra column to count how many times this instrument appears in the other view.
Seems simple enough, but when I run this query, I get the oracle error ORA-00904 - invalid column name, with 'ThisINSID' highlighted in the subquery
select v.insid ThisINSID, cp.ProcsOutstanding
from V_INS_ENTS_OUSTANDING v,
(select count(*) ProcsOutstanding from v_monitored_procs vmp where vmp.INSID = ThisINSID) cp;
How then should I do this?
Thanks Mark
I know this is a really elementary question, but I keep getting caught out by it.
I've got one view where it lists some stuff
SQL> select * from v_ins_ents_oustanding;
INSID INSNAME OUTSTANDING
---------- ------------------------------ -----------
101 MS8 17
102 MS9 0
I've got another view which contains some more information
SQL> select insid from v_monitored_procs;
INSID
----------
102
102
What I'd like to do is make a third view, which essentially contains v_ins_ents_oustanding, but with an extra column to count how many times this instrument appears in the other view.
Seems simple enough, but when I run this query, I get the oracle error ORA-00904 - invalid column name, with 'ThisINSID' highlighted in the subquery
select v.insid ThisINSID, cp.ProcsOutstanding
from V_INS_ENTS_OUSTANDING v,
(select count(*) ProcsOutstanding from v_monitored_procs vmp where vmp.INSID = ThisINSID) cp;
How then should I do this?
Thanks Mark