Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Views containing Multiple Table queries??

Re: Views containing Multiple Table queries??

From: David Busby <dbusby3_at_slb.com>
Date: Mon, 02 Apr 2001 08:46:30 -0500
Message-ID: <3AC882B5.5956DB86@slb.com>

Yes you can create a view.

create view viewname as (select accounts.fielname, purchase.emp_id from accounts, purchase where

    accounts.emp_id=purchase.emp_id);

Something like this. I would need to know the field names in your tables to give you a better example.

Adrian Quezada wrote:

> 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 Mon Apr 02 2001 - 08:46:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US