Received: from localhost.localdomain (h246.ozemail2.ozemail.com.au [203.108.14.246]) by hub.org (8.9.3/8.9.3) with ESMTP id DAA74413 for ; Tue, 8 Jun 1999 03:13:27 -0400 (EDT) (envelope-from chris.bitmead@bigfoot.com) Received: from bigfoot.com (localhost [127.0.0.1]) by localhost.localdomain (8.9.3/8.9.3) with ESMTP id RAA06289 for ; Tue, 8 Jun 1999 17:12:13 +1000 Sender: chris@localhost.localdomain Message-ID: <375CC24C.7AC23109@bigfoot.com> Date: Tue, 08 Jun 1999 17:12:12 +1000 From: Chris Bitmead X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.2.6 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@hub.org Subject: Re: [SQL] Slashdot Query References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit It looks to me like that solution would simply be a list of all the categories (assuming there is a story in every category). What I want is the 5 unique categories applying to the most recent stories. "Jackson, DeJuan" wrote: > > Is it me or does this query actually make any sense??? > Is story.datetime a column in your table? yes > > You might be able to rewrite this query. I don't know if the > ordering you were trying for is needed, but > > SELECT oid, title, image FROM category* > WHERE EXISTS(SELECT 1 FROM story > WHERE story.approved AND story.category = > category.oid); > > should give you the same information. > > Hope this helps, > -DEJ > > > Chris Bitmead writes: > > > SELECT category.oid, category.title, category.image FROM story, > > > category* WHERE story.category = category.oid AND story.approved GROUP > > > BY category.oid, category.title, category.image ORDER BY min(datetime); > > > pqReadData() -- backend closed the channel unexpectedly. > > > This probably means the backend terminated abnormally > > > before or while processing the request. > > > We have lost the connection to the backend, so further processing is > > > impossible. Terminating. > > > > This is a known problem --- see my pghackers email of a few days ago, > > "inherited GROUP BY is busted". > > > > regards, tom lane