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 7B5783CC874 for ; Fri, 17 Dec 2004 12:37:22 +0000 (GMT) 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 39868-08 for ; Fri, 17 Dec 2004 12:37:09 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id 53D003CC71F for ; Fri, 17 Dec 2004 12:37:11 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 4.42) id 1CfHM7-000KQC-8c; Fri, 17 Dec 2004 12:37:11 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 1B5BC15921; Fri, 17 Dec 2004 12:37:07 +0000 (GMT) Message-ID: <41C2D2F1.4090205@archonet.com> Date: Fri, 17 Dec 2004 12:37:05 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcus Claesson Cc: pgsql-sql@postgresql.org Subject: Re: can't get the order I want after inserting new rows References: <1103276805.17814.493.camel@morpheus.ucc.ie> In-Reply-To: <1103276805.17814.493.camel@morpheus.ucc.ie> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.089 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/119 X-Sequence-Number: 19739 Marcus Claesson wrote: > Hi! > > I have a problem with getting the order I want on a table after new rows > have been inserted. I try to simplify it...: > In other words, I have this old table: > SELECT * from table ORDER BY full,part; > > name full part score > ---- --- --- ----- > a 1 1 900 > a 1 2 500 > and I insert these rows into the same table: > (there's nothing I can do about these 'full' values) > > d 1 1 1000 > d 1 2 400 > And after some manipulation (that I hope someone can help me with) I > want the query above (SELECT * from table ORDER BY full,part) to give > this: > > d 1 1 1000 > d 1 2 400 > a 2 1 900 Just looking at the start of your output, you are missing some rows (a/1/1) and have replaced others (a/2/1 isn't in your data). Are you trying to summarise, and if so by what? Can you explain how you would do this by hand. Could you provide the actual table definition? -- Richard Huxton Archonet Ltd