X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AA94DD1B4AD for ; Fri, 12 Dec 2003 22:18:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 01515-07 for ; Fri, 12 Dec 2003 18:17:58 -0400 (AST) Received: from mail.tessermarketing.net (unknown [208.187.226.112]) by svr1.postgresql.org (Postfix) with ESMTP id 7BCE3D1BA62 for ; Fri, 12 Dec 2003 18:17:40 -0400 (AST) Received: from dsl-9-214.ipns.com ([198.79.9.214] helo=tesseract.net) by mail.tessermarketing.net with esmtp (Exim 3.35 #1 (Debian)) id 1AUvbI-0003eh-00 for ; Fri, 12 Dec 2003 14:17:32 -0800 Message-ID: <3FDA3F09.4050205@tesseract.net> Date: Fri, 12 Dec 2003 14:19:53 -0800 From: Nathaniel Price User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en, es MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: Reordering results for a report References: <3FDA0AE7.60200@tesseract.net> <20031212211644.GB6384@wolff.to> In-Reply-To: <20031212211644.GB6384@wolff.to> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/714 X-Sequence-Number: 54108 On 12/12/2003 1:16 PM, Bruno Wolff III wrote : >On Fri, Dec 12, 2003 at 10:37:27 -0800, > Nathaniel Price wrote: > > >>So is there a way to make a query where I can sort arbitrarily without >>having to create additional data in the database? >> >> > >You have to save the state somewhere. If there is somewhere else other >than the database you can do this (e.g. cookies, URLs, etc...) then >you might be able to do it. > > Drat. I was hoping that you could use some sort of subquery... ah well. However, I was just looking at the documentation for CREATE TABLE and noticed that you can create temporary tables which only last as long as the "session". I think I'll probably use these to store the sorting order by creating tables with a unique name (perhaps something generated by PHP's uniqid()) and joining on that-- not exactly what I had in mind, but at least that way I don't have to worry so much about garbage collection. Although I'm not sure how they'd work with persistant database connections in PHP... -- ___________________________ Nathaniel Price http://www.tesserportal.net Webmaster