Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Views containing Multiple Table queries??
Have you tried this?
CREATE VIEW AS
SELECT a.EMP_ID, a.NAME, COUNT(*)
FROM ACCOUNTS a, PURCHASE b
WHERE a.EMP_ID = b.EMP_ID
GROUP BY a.EMP_ID
"Adrian Quezada" <anon_at_anon.com> wrote in message
news:rrsvat4jv52ue5i4hia69o702tsl4m2964_at_4ax.com...
> HI All,
>
> Is it possible to build a view that queries multiple tables, but still
> be able to access the view as if it was single table?
>
> What I would to accomplish is a way that I can query my accounts table
> and then use the emp_id to determine how many enteries that emp_id has
> in another table. I am currently using multiple SQL statements:
>
> For the Accounts table:
> Select * from Accounts
>
> To find the number of instances
> select count(emp_id) from purchase where empid=(emp_id to look for);
>
> It would be great if I could something like:
>
> select * from EMPLOYEE_VIEW
>
> and have it return:
>
> Emp_id Name Count
> 11111 abc 20
> 22222 def 1
> 33333 ghi 20
>
> Is this even possible? If not, what would be the best way to
> accomplish this with a single select statement?
>
> Any and all help would be greatly appreciated.
Received on Wed Mar 14 2001 - 20:07:31 CST
![]() |
![]() |