Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id RAA69217 for ; Sat, 18 Dec 1999 17:48:44 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id RAA01607; Sat, 18 Dec 1999 17:48:08 -0500 (EST) To: angelko@saw.net cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] [Q] Merging two queries? In-reply-to: Your message of Sat, 18 Dec 1999 15:00:18 -0800 (PST) Date: Sat, 18 Dec 1999 17:48:07 -0500 Message-ID: <1604.945557287@sss.pgh.pa.us> From: Tom Lane That's an easy one: SELECT ... UNION SELECT ... does exactly what you need. You can leave DISTINCT off the individual SELECTs because UNION implies a DISTINCT pass over the merged output. (Use UNION ALL if you don't want a final DISTINCT pass.) regards, tom lane