Re: How I write pretty query

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Rado Petrik <r(dot)p(at)szm(dot)sk>
Cc: PostgreSQL-mailinglist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How I write pretty query
Date: 2003-04-29 17:55:00
Message-ID: 20030429105204.M47437-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sergey Holod 2003-04-29 20:53:18 Making "SECURITY DEFINER" procedures..
Previous Message Rado Petrik 2003-04-29 17:46:05 How I write pretty query