Re: Qeury a boolean column?(using postgresql & EJB)

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: dycharles <charleslinzon_dy(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Qeury a boolean column?(using postgresql & EJB)
Date: 2007-11-17 02:01:43
Message-ID: CE1B9BB1-2880-4B84-AEC0-241FB90CDE0E@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Nov 14, 2007, at 17:05 , dycharles wrote:

> i have a database in postgresql that have a column boolean, then
> when i
> create a query in ejb like this(SELECT e.letsaythisisboolean FROM
> sample e),
> now problem is that when i query the database in ejb, it will
> return all the
> false value in the column boolean, and the true value will not
> return... How
> can i make the true value appear in my query result? Any suggestion or
> help...

If you want *only* rows which have e.letsaythisisboolean as true, then:

select e.letsaythisisboolean
from sample e
where e.letsaythisisboolean;

Your query is returning all of the rows of the table. Either sample
doesn't contain any rows where letsaythisisboolean is true or you
just haven't looked through all of them yet.

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2007-11-17 02:50:14 Re: Primary Key
Previous Message D. Dante Lorenso 2007-11-17 01:29:54 pg_dump not including custom CAST?