X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E279A32A179 for ; Mon, 11 Oct 2004 10:49:34 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44213-03 for ; Mon, 11 Oct 2004 09:49:25 +0000 (GMT) Received: from stan.ringways.co.uk (hub.ringways.co.uk [213.38.87.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9990C329FBF for ; Mon, 11 Oct 2004 10:49:25 +0100 (BST) Received: from gary.ringways.co.uk ([10.1.1.2]) by stan.ringways.co.uk with esmtp (Exim 3.22 #1) id 1CGws9-0004wk-00 for pgsql-sql@postgresql.org; Mon, 11 Oct 2004 10:53:41 +0100 Content-Type: text/plain; charset="us-ascii" From: Gary Stainburn Organization: Ringways Garages Ltd To: pgsql-sql@postgresql.org Subject: table update using result from join Date: Mon, 11 Oct 2004 10:49:24 +0100 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200410111049.24363.gary.stainburn@ringways.co.uk> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/74 X-Sequence-Number: 19177 Hi folks. I'm annoyed that I can't sus out something this simple. The join below gives the output I want, but I can't work out how to convert it to be an update on the requests field. I want to append the customer name to the fuel (delivery details) field and then update the customer field to be 'retail'. but I can't work out the description update bit. goole=# select r.r_fuel||' - Customer: '||c.c_des from requests r, customers c goole-# where r.r_c_id = c.c_id and c.c_id in ( goole(# 9, 10, 13, 27, 35, 36, 39, 42, 44, 51, 53, 54, 55, 56, 57, 58, 60, 65, 67, 69, goole(# 74, 75, 77, 81, 82, 84, 88, 89, 90, 91, 92, 96, 98, 99, 100, 101, 102, 103, goole(# 105, 108, 113, 114, 117, 118, 124, 125, 126, 131, 132, 135, 136, 137, 144, goole(# 145, 148, 149, 150, 151, 154, 11, 37, 40, 41, 43, 48, 52, 59, 62, goole(# 63, 68, 70, 71, 83, 86, 93, 104, 119, 120, 121, 123, 128, 129, 130, goole(# 134, 138, 142, 146, 147, 152, 153, 19, 38, 85, 87, 94, 106, 112, 116, goole(# 141, 143, 18, 110, 111, 115, 140, 24, 50, 133, 47, 64, 76, 95, 107, goole(# 109, 127, 33, 46, 97); ?column? ------------------------------------------------------------------------------------- RINGWAYS - Customer: SUBSCAN RINGWAYS - Customer: MARTIN ? - Customer: N G BAILEY ? - Customer: CHECRON SITE SERVICES LTD 10 litres - Customer: CONSULTANT SERVICES ? - Customer: ALD AUTOMOTIVE eskrigg yo19 6ez 9am - Customer: TRANSPORT MANAGEMENT TRAILER / PE18 9UH / HALF ON DELIVERY - Customer: ALD AUTOMOTIVE DRIVEN / WF16 0NF - Customer: CONSULTANT SERVICES TRAILER / HALF TANK ON DELIVERY - Customer: LEX / SWINTON DN14 0HR - Customer: CHECRON SITE SERVICES LTD . - Customer: other fleet [snip] (256 rows) goole=# What I want is something like update requests set r_fuel=, r_c_id = 7 where r_c_id in (....... -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000