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_at_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 Thu Jun 15 2006 - 00:29:03 CEST

Original text of this message