different between || and && in a statement

From: guenther(at)laokoon(dot)IN-Berlin(dot)DE (Christian Guenther)
To: pgsql-sql(at)hub(dot)org
Subject: different between || and && in a statement
Date: 1999-10-25 19:43:15
Message-ID: 199910251943.VAA13984@laokoon.bug.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)kunst-und-kultur(dot)de
Tel: +49 030 4442931 http://kunst-und-kultur.de/
Museen, Kuenstler, Ausstellungen, Kunstprojekte ....

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Zot O'Connor 1999-10-25 19:47:17 Re: [SQL] Week of year function?
Previous Message Moray McConnachie 1999-10-25 19:04:22 Re: [SQL] Week of year function?