X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 25EDC47632B for ; Fri, 4 Apr 2003 15:08:49 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 8FE5A47631F for ; Fri, 4 Apr 2003 15:08:48 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 6F49D43A911; Fri, 4 Apr 2003 15:08:48 -0500 (EST) From: sylfanie@club-internet.fr (Stephane) X-Newsgroups: comp.databases.postgresql.sql Subject: Difficult query (for me) Date: 4 Apr 2003 12:06:22 -0800 Organization: http://groups.google.com/ Lines: 36 Message-ID: <4ff986f9.0304041206.1ae7b97a@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-1.6 required=5.0 tests=BAYES_30 version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/93 X-Sequence-Number: 12794 Hello, Basicaly I have two tables like this: Table 1 RecordName Value a 100 b 100 c 100 d 100 e 100 f 100 Table 2 RecordName Value a 25 b 50 c 75 g 150 h 150 I would like a query that give me a result like this: a 75 (100-25) b 50 (100-50) c 25 d 100 e 100 f 100 g -150 h -150 It is table1-table2.=20 I could do it for records a,b,c but I do not how to have record which are only in one of the two tables. Thanks for your help. Stephane.