Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: View with mixed fields
"Michel Cadot" <micadot{at}altern{dot}org> wrote in message news:<406351db$0$11609$636a15ce_at_news.free.fr>...
> "Gregor Horvath" <g.horvath_at_gmx.at> a écrit dans le message de
> news:RQH8c.240846$Or1.163922_at_news.chello.at...
> > Hello,
> >
> > I have two tables:
> >
> > Table A:
> >
> > Field 1
> > --------
> > 1
> > 2
> > 4
> > 5
> > 7
> >
> >
> > Table B:
> >
> > Field 1 Field 2
> > ------------------------
> > 1 3
> > 2 6
> > 5 8
> >
> > I want to create a view which mixes the values of tableA.Field1 and
> > tableB.Field2 into one field 3 of the result view.
> >
> > result view:
> >
> > Field3
> > -------
> > 1 (from tableA.Field1)
> > 2 (from tableA.Field1)
> > 3 (from tableB.Field2)
> > 4 (from tableA.Field1)
> > 5 (from tableA.Field1)
> > 6 (from tableB.Field2)
> > 7 (from tableA.Field1)
> > 8 (from tableB.Field2)
> >
> >
> > Is this possible?
> > How?
> >
> > Greg
> >
>
> select field1 from tableA union all select field2 from tableB;
>
> Regards
> Michel Cadot
Before someone jumps on my last post, if you create a view don't bother with the order by. That needs to be specified when selecting from the view.
create view view1
as select field1 from tableA union all select field2 from tableB;
select field1 from view1 order by field1; Received on Thu Mar 25 2004 - 22:41:39 CST
![]() |
![]() |