Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux