Re: select from (select)
- From: "Art S. Kagel" <kagel@xxxxxxxxxxxxx>
- Date: Mon, 17 Jul 2006 16:54:00 -0400
rakesh_sa@xxxxxxxxx wrote:
Hi Prateek,
Please see to the query mentioned below.This query works fine in oracle
& not in informix.
Any hints highly appretiated.
select a.col1 , b.col2 from
(select column1 col1 from table1) a,
(select column2 col2 from table2) b,
where a.col1 = b.col2
Thanks
Rakesh.
<SNIP>
Prateek:
In the general case Jonathan's proposal of using the 9.xx+ syntax: TABLE(MULTISET(SELECT...)) is the equivalent of the syntax above, however, ALL of the 'FROM (select..)' constructs can be produced using either temp tables or views and most can be implemented as simple joins. Also the TABLE and MULTISET casts are not available in earlier releases of IDS. So here are the options as I see them:
Using temp tables:
select column1 col1 from table1 into temp a;
select column2 col2 from table2 into temp b;
select a.col1, b.col2
from a, b
where a.col1 = b.col2;
drop table a;
drop table b;
Another solution using views:
create view first(col1) as select column1 col1 from table1;
create view second(col2) as select column2 col2 from table2;
select a.col1, b.col2
from first a, second b
where a.col1 = b.col2;
drop view first;
drop view second;
-- OR a bit less dramatically using a simple join --
select a.column1 as col1, b.column2 as col2
from table1 a, table2 b
where col1 = col2;
-- OR using ANSI syntax --
select a.column1 as col1, b.column2 as col2
from table1 a
join table2 b
on col1 = col2;
Art S. Kagel
.
- References:
- select from (select)
- From: rakesh_sa
- Re: select from (select)
- From: Prateek Jain
- Re: select from (select)
- From: rakesh_sa
- select from (select)
- Prev by Date: Re: Run 'onunload' on an HDR secondary?
- Next by Date: Re: reorg by restore
- Previous by thread: Re: select from (select)
- Next by thread: Re: select from (select)
- Index(es):
Relevant Pages
|
Loading