Re: [SQL] Casting integer to boolean

2002-08-16 Thread Christopher Kings-Lynne
> select not count(*) = 0 from my_table; > > Basically, for any integer i, convert to boolean with: not i = 0 Or i != 0 of course... Chris ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "

Re: [SQL] Casting integer to boolean

2002-08-16 Thread Tod McQuillin
On Fri, 16 Aug 2002, Bhuvan A wrote: > How do i cast an integer value to boolean? You can always do something like this: select not count(*) = 0 from my_table; Basically, for any integer i, convert to boolean with: not i = 0 -- Tod McQuillin ---(end of broadcast)---

[SQL] Casting integer to boolean

2002-08-16 Thread Bhuvan A
Hi, I am using postgresql 7.2.1. How do i cast an integer value to boolean? I did try the below sequence of SQLs and was little bit confused, by the way it behaves. It casts the integer value to boolean in one case but not ever again. bhuvan=> SELECT count(*)::int::boolean from my_table; ERROR: