Обсуждение: Re: [HACKERS] AND &&

Поиск
Список
Период
Сортировка

Re: [HACKERS] AND &&

От
Vince Vielhaber
Дата:
Thomas Lockhart <lockhart@alumni.caltech.edu> said: 

> > I think I asked this before but don't recall seeing an answer.  Do we
> > have a logical AND?
> 
> Uh, yes. It's called "AND" ;)

That's what I was afraid of.
   ERROR:  left-hand side of AND is type 'int4', not bool


Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
128K ISDN - $24.95/mo or less; 56K Dialup - $17.95/mo or less www.pop4.net       Online Campground Directory
http://www.camping-usa.com     Online Giftshop Superstore    http://www.cloudninegifts.com
 
==========================================================================






Re: [HACKERS] AND &&

От
Don Baccus
Дата:
At 11:00 AM 12/15/99 -0500, Vince Vielhaber wrote:
>Thomas Lockhart <lockhart@alumni.caltech.edu> said: 
>
>> > I think I asked this before but don't recall seeing an answer.  Do we
>> > have a logical AND?
>> 
>> Uh, yes. It's called "AND" ;)
>
>That's what I was afraid of.
>
>    ERROR:  left-hand side of AND is type 'int4', not bool

>SELECT (( sum(case dict.word when 'enable' then 1 else 0 end) && sum(case
>dict.word when 'test'  then 1 else 0 end)))

try something like

select ((sum(case dict.work when 'enable' then 1 else 0 end) > 0 and        sum(case dict.word when 'test' then 1 else
0end) > 0))
 

or perhaps rewrite the query to use "exists"???  That appears to be the
point of this snippet.

Apparently mySQL is misnamed.  Perhaps it should be renamed myC-ishQL.



- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 


Re: [HACKERS] AND &&

От
Tom Lane
Дата:
Vince Vielhaber <vev@michvhf.com> writes:
>> Uh, yes. It's called "AND" ;)

> That's what I was afraid of.

>     ERROR:  left-hand side of AND is type 'int4', not bool

1 => 't'::bool, etc.
        regards, tom lane


Re: [HACKERS] AND &&

От
Tom Lane
Дата:
I wrote:
> 1 => 't'::bool, etc.

Er, ignore that ... I missed the sum() operator.  Don Baccus has
more reasonable comments ...
        regards, tom lane