pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Rado Petrik <r.p@szm.sk>
Cc: PostgreSQL-mailinglist <pgsql-sql@postgresql.org>
Subject: Re: How I write pretty query
Date: Tue, 29 Apr 2003 10:55:00 -0700 (PDT)
Message-ID: <20030429105204.M47437-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <1051638365.775.95.camel@caj>


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;




view thread (3+ messages)

Message-ID: <20030429105204.M47437-100000@megazone23.bigpanda.com>
Permalink:  ../20030429105204.M47437-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030429105204.M47437-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, r.p@szm.sk
  Subject: Re: How I write pretty query
  In-Reply-To: <20030429105204.M47437-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox