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

Home -> Community -> Usenet -> c.d.o.server -> Re: newbie: SQL join/union question

Re: newbie: SQL join/union question

From: Akira Nakayama <akira.nakayama_at_nifty.ne.jp>
Date: Tue, 9 Feb 1999 22:32:09 +0900
Message-ID: <79pd2j$8rd$1@news-all.nifty.ne.jp>


SELECT seqid,name,info FROM name1
UNION
SELECT seqid,name,"*" FROM name2;

Mark Foley wrote in message <79o02m$d8h_at_journal.concentric.net>...
>I have two tables NAME1 and NAME2, with 3 and 2 columns respectively, as
>follows:
>
> NAME1
> ----------
>
> SEQID NAME INFO
> --------- --------- --------
> 1 Mark Possible criminal
> 2 Jim Possible criminal
> 3 Bill Confirmed criminal
>
> NAME2
> -----------
> SEQID NAME
> --------- ---------
> 4 Jon
> 5 Jack
> 6 Ryan
>
>
> I need a select statement that returns a single Table as follows:
>
> RESULT TABLE
> -----------------------
>
> SEQID NAME INFO
> --------- --------- --------
> 1 Mark Possible criminal
> 2 Jim Possible criminal
> 3 Bill Confirmed criminal
> 4 Jon *
> 5 Jack *
> 6 Ryan *
>
>
> If I use:
>SELECT seqid from NAME1
>UNION
>SELECT seqid from NAME2;
>
>I get the 6 returned rows, which is what I want. I cannot however figure
out
>how
>to include the "INFO" column in the result set, because that column doesn't
>exist in
>the NAME2 table. The "*" could be anything that allows me to determine that
>that
>result column was empty.
>
>
>
>

Akira Nakayama From Japan Received on Tue Feb 09 1999 - 07:32:09 CST

Original text of this message

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