Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5L9XJa67945 for ; Thu, 21 Jun 2001 05:33:20 -0400 (EDT) (envelope-from dev@archonet.com) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 2.12 #1) id 15D0r5-0006sd-0V; Thu, 21 Jun 2001 10:34:28 +0100 Received: from client (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with SMTP id EC69B13A76; Thu, 21 Jun 2001 10:29:26 +0100 (BST) Message-ID: <00ac01c0fa34$a9948460$1001a8c0@archonet.com> From: "Richard Huxton" To: "Joseph Shraibman" , References: <3B30FB0A.3595CD79@selectacast.net> Subject: Re: select by streak Date: Thu, 21 Jun 2001 10:29:24 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200106/324 X-Sequence-Number: 3611 From: "Joseph Shraibman" > Lets say I have a table like this: > > id int <== primary key > ts timestamp > name text > status char > > status is G for good or B for bad. How do I do something like: > SELECT name FROM mytable WHERE 'B'> and ? You're looking at a procedural solution here rather than SQL I'd suspect. Either do this in your application or look into plpgsql or pltcl. You might be able to do something with LIMIT and subselects (which I believe cooperate in 7.1 - but test it) but it isn't going to be pretty. HTH - Richard Huxton