Received: from tech.com.au (IDENT:root@techpt.lnk.telstra.net [139.130.75.122]) by hub.org (8.9.3/8.9.3) with ESMTP id MAA63571 for ; Fri, 30 Apr 1999 12:15:33 -0400 (EDT) (envelope-from chris.bitmead@bigfoot.com) Received: from bigfoot.com (chris@localhost [127.0.0.1]) by tech.com.au (8.8.7/8.8.7) with ESMTP id CAA25019 for ; Sat, 1 May 1999 02:15:38 +1000 Sender: chris@tech.com.au Message-ID: <3729D728.281FBCDC@bigfoot.com> Date: Fri, 30 Apr 1999 16:15:36 +0000 From: Chris Bitmead X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: "'pgsql-sql@hub.org'" Subject: Re: [SQL] combining a single field in two tables into one column. References: <01BE9300.DA3BFC80.jt-kirkpatrick@mpsllc.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit You need something along the lines of SELECT subnum FROM subs UNION SELECT vnum FROM vend; JT Kirkpatrick wrote: > > 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 -- Chris Bitmead http://www.bigfoot.com/~chris.bitmead mailto:chris.bitmead@bigfoot.com