pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: guenther@laokoon.IN-Berlin.DE
To: pgsql-sql@hub.org
Subject: different between || and && in a statement
Date: Mon, 25 Oct 1999 21:43:15 +0200 (CEST)
Message-ID: <199910251943.VAA13984@laokoon.bug.net> (raw)

Hi,

I hope theis is the last question for the next time:

1st statement:

SELECT (sum(case when dict.word = 'museum' then 1 else 0 end) 
&& sum(case when dict.word = 'immer' then 1 else 0 end)) as qu , dict.url_id
^^             FROM dict, url 
             WHERE url.rec_id = dict.url_id
                   AND url.url LIKE '%%' 
                   AND dict.word in ('museum','immer') 
             GROUP BY dict.url_id  
             HAVING sum(case when dict.word = 'museum' then 1 else 0 end) && 
sum(case when dict.word = 'immer' then 1 else 0 end) > 0                  ^^

The result is:

ERROR:  Unable to identify an operator '&&' for types 'int4' and 'int4'
        You will have to retype this query using an explicit cast

but if a do it with :

SELECT (sum(case when dict.word = 'museum' then 1 else 0 end)
|| sum(case when dict.word = 'immer' then 1 else 0 end)) as qu , dict.url_id
^^             FROM dict, url
             WHERE url.rec_id = dict.url_id
                   AND url.url LIKE '%%'
                   AND dict.word in ('museum','immer')
             GROUP BY dict.url_id
             HAVING sum(case when dict.word = 'museum' then 1 else 0 end) || 
sum(case when dict.word = 'immer' then 1 else 0 end) > 0                  ^^

.... all is OK

Whats the different between the logical expression && and || and is there
a way to get && working?

Thanks for any hints. I hope the isn't a stupid question.

Christian

-- 
 Christian Guenther                              Kunsthistoriker 
 Fax: +49 030 4464152             E-mail: cg@kunst-und-kultur.de
 Tel: +49 030 4442931                http://kunst-und-kultur.de/
      Museen, Kuenstler, Ausstellungen, Kunstprojekte ....



view thread (2+ messages)  latest in thread

Message-ID: <199910251943.VAA13984@laokoon.bug.net>
Permalink:  ../199910251943.VAA13984@laokoon.bug.net/
Also on:    postgresql.org/message-id/199910251943.VAA13984@laokoon.bug.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: guenther@laokoon.IN-Berlin.DE, pgsql-sql@hub.org
  Subject: Re: different between || and && in a statement
  In-Reply-To: <199910251943.VAA13984@laokoon.bug.net>
  References: <199910251943.VAA13984@laokoon.bug.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox