Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!ucbvax!husc6!amcad!stech!sysop From: sysop@stech.UUCP (Jan Harrington) Newsgroups: comp.databases Subject: Re: SQL question Message-ID: <459@stech.UUCP> Date: 27 Feb 88 04:48:53 GMT References: <34358UH2@PSUVM> Organization: Scholastech, Inc., Waltham, Mass. Lines: 30 in article <34358UH2@PSUVM>, UH2@PSUVM.BITNET (Lee Sailer) says: > > I've only read about SQL, and have never had to write a query in it. > This morning I am wondering, how do you do a simple relational > UNION in SQL? That is, given two relations, R1 and R2, how do > you create R3 that contains those tuples that are in either R1, R2, or > both, assuming that R1 and R2 have the same attributes? Assuming that your SQL implementation supports UNION (not all do), you could try something like: SELECT * FROM R1 UNION SELECT * FROM R2; UNION will link two independent SELECTs (both SELECTS must include the same column names, in the same order) or the results of two subqueries. Jan Harrington, sysop Scholastech Telecommunications UUCP: ihnp4!husc6!amcad!stech!sysop or allegra!stech!sysop BITNET: JHARRY@BENTLEY ******************************************************************************** Miscellaneous profundity: "No matter where you go, there you are." Buckaroo Banzai ********************************************************************************