Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Determine source-table from field within join?
On Aug 13, 8:19 am, Steve Howard <stevedhow..._at_gmail.com> wrote:
> On Aug 13, 3:49 am, dean <deanbrow..._at_yahoo.com> wrote:
>
> > 10g.
>
> > How can one tell which table a field in a query comes from? For
> > example a join between tables A and B contains 10 fields (F1 to F10),
> > 5 from A and 5 from B. How would one tell if field F1 is from A or B?
> > Is there a SQL-parsing system view?
>
> A query can't be parsed if the same column exists in two sources,
> without an alias...
>
That depends upon how you write it:
SQL> create table t0813a(a number, b number, c number);
Table created.
SQL> create table t0813b(a number, b number, d number);
Table created.
SQL> insert into t0813a values(1,2,2);
1 row created.
SQL> insert into t0813b values(1,2,3);
1 row created.
SQL> commit;
Commit complete.
SQL> select *
2 from t0813a natural join t0813b;
A B C D ---------- ---------- ---------- ----------
1 2 2 3
SQL> No aliases exist, common columns abound, and yet a result is returned.
David Fitzjarrell Received on Mon Aug 13 2007 - 09:09:56 CDT
![]() |
![]() |