pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Jackson, DeJuan <djackson@cpsgroup.com>
To: JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>
To: 'pgsql-sql@hub.org' <pgsql-sql@hub.org>
Subject: RE: [SQL] combining a single field in two tables into one column.
Date: Fri, 30 Apr 1999 11:02:47 -0500
Message-ID: <D05EF808F2DFD211AE4A00105AA1B5D210072A@cpsmail> (raw)
try:
select subnum from subs
union all
select vnum from vend;
-DEJ
> -----Original Message-----
> From: JT Kirkpatrick [SMTP:jt-kirkpatrick@mpsllc.com]
> Sent: Friday, April 30, 1999 10:59 AM
> To: 'pgsql-sql@hub.org'
> Subject: [SQL] combining a single field in two tables into one
> column.
>
> i come seeking wisdom. . .
>
> i have two tables, one for subcontractors and another for vendors. subs
> have a primary key of subnum int4, vendors a primary key of vnum int4. i
> need to create a query that allows me to see a complete list of these
> numbers in a single column. for instance, subnum (all begin with 9) has
> values 90001, 90002, 90003 (only three records for the example), and vnum
> (all begin with 2) has values 20001, 20002. i'd like my query result to
> show:
>
> 90001
> 90002
> 90003
> 20001
> 20002
>
> this does NOT work: select a.subnum as z, b.vnum as z from subs a, vend
> b;
> NOR does: select a.subnum, b.vnum from subs a, vend b;
>
> by the way, the two tables DO NOT relate to each other (i.e., 90001 does
> not have anything to do with 20001). . .
>
> TIA, jt
view thread (4+ messages) latest in thread
Message-ID: <D05EF808F2DFD211AE4A00105AA1B5D210072A@cpsmail> Permalink: ../D05EF808F2DFD211AE4A00105AA1B5D210072A@cpsmail/ Also on: postgresql.org/message-id/D05EF808F2DFD211AE4A00105AA1B5D210072A@cpsmail ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-sql@postgresql.org Cc: djackson@cpsgroup.com, jt-kirkpatrick@mpsllc.com, pgsql-sql@hub.org Subject: Re: [SQL] combining a single field in two tables into one column. In-Reply-To: <D05EF808F2DFD211AE4A00105AA1B5D210072A@cpsmail> References: <D05EF808F2DFD211AE4A00105AA1B5D210072A@cpsmail> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox