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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Results in Parallel columns

Re: Results in Parallel columns

From: Mike C# <xxx_at_yyy.com>
Date: Wed, 14 Jun 2006 18:29:03 -0400
Message-ID: <150kg.6572$AI5.1609@fe08.lga>


CREATE TABLE #a (Idx INT NOT NULL PRIMARY KEY,  Val INT NOT NULL)

CREATE TABLE #b (Idx INT NOT NULL PRIMARY KEY,  Val INT NOT NULL)

INSERT INTO #a (Idx, Val)
SELECT 1, 12
UNION SELECT 2, 34
UNION SELECT 3, 45 INSERT INTO #b (Idx, Val)
SELECT 1, 34
UNION SELECT 2, 44
UNION SELECT 3, 98 SELECT a.Idx, a.Val, b.Val
FROM #a a
INNER JOIN #b b
ON a.Idx = b.Idx
ORDER BY a.Idx

DROP TABLE #a
DROP TABLE #b

"vivekian" <vivekaseeja_at_gmail.com> wrote in message news:1150320359.977336.291500_at_i40g2000cwc.googlegroups.com...
> Hi ,
>
> I need to place the results of two different queries in the same result
> table parallel to each other.
> So if the result of the first query is
>
> 1 12
> 2 34
> 3 45
>
> and the second query is
>
> 1 34
> 2 44
> 3 98
>
> the results should be displayed as
>
> 1 12 34
> 2 34 44
> 3 45 98
>
> If a union is done for both the queries , we get the results in rows.
> How can the above be done.
>
> Thanks in advance,
> vivekian
>
Received on Wed Jun 14 2006 - 17:29:03 CDT

Original text of this message

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