Re: How I write pretty query - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: How I write pretty query
Date
Msg-id 20030429105204.M47437-100000@megazone23.bigpanda.com
Whole thread Raw
In response to How I write pretty query  (Rado Petrik <r.p@szm.sk>)
List 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;
 



pgsql-sql by date:

Previous
From: Rado Petrik
Date:
Subject: How I write pretty query
Next
From: Sergey Holod
Date:
Subject: Making "SECURITY DEFINER" procedures..