X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2A188475B47 for ; Tue, 29 Apr 2003 13:55:37 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 5B6F6475B47 for ; Tue, 29 Apr 2003 13:55:01 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 3E7CAD635; Tue, 29 Apr 2003 10:55:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 13E685C04; Tue, 29 Apr 2003 10:55:01 -0700 (PDT) Date: Tue, 29 Apr 2003 10:55:00 -0700 (PDT) From: Stephan Szabo To: Rado Petrik Cc: PostgreSQL-mailinglist Subject: Re: How I write pretty query In-Reply-To: <1051638365.775.95.camel@caj> Message-ID: <20030429105204.M47437-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-15.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,NO_DNS_FOR_FROM autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/429 X-Sequence-Number: 13130 On 29 Apr 2003, Rado Petrik wrote: > I have table > > ------------------ > id | name > ------------------ > 1 rado > 2 marek > 3 pista > > I need make query. Your output is only (true or false) If you don't specifically care about the string true/false and just want a boolean, probably something like: select exists (select * from tab where name='rado'); If you really want the particular strings, use a case, something like: select case when exists(select * from tab where name='rado') then 'true' else 'false' end;