pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: guenther@laokoon.IN-Berlin.DE
To: pgsql-sql@hub.org
Subject: Re: [SQL] different between || and && in a statement
Date: Tue, 26 Oct 1999 16:28:17 +0200
Message-ID: <l03130303b43b69f1ad68@[147.233.159.109]> (raw)
In-Reply-To: <199910251943.VAA13984@laokoon.bug.net>

At 21:43 +0200 on 25/10/1999, Christian Guenther wrote:


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

It's really not clear what you are trying to achieve here. Neither || nor
&& are logical operators. In Postgres, || is string concatenation, not
"or". What you would get in sum(...) || sum( ... ) is the concatenation of
the two sums. If one is 32 and the other 17, you'd get 3217.

In any case, what sense does a logical operator have between two integers?
Logical operators should connect between logical operands. But the sums are
sums of integers. There is no such thing as a boolean sum. Unless you meant
to do a cumulative "or" operation between all the rows that have the proper
string value? In that case, you really have to build a custom aggregate for
it.

In any case, in SQL, the word for "or" is... OR. The word for "and" is AND
and the word for "not" is NOT.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





view thread (2+ messages)

Message-ID: <l03130303b43b69f1ad68@[147.233.159.109]>
Permalink:  ../l03130303b43b69f1ad68@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03130303b43b69f1ad68@[147.233.159.109]

 · 

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: herouth@oumail.openu.ac.il, guenther@laokoon.IN-Berlin.DE, pgsql-sql@hub.org
  Subject: Re: [SQL] different between || and && in a statement
  In-Reply-To: <l03130303b43b69f1ad68@[147.233.159.109]>
  References: <199910251943.VAA13984@laokoon.bug.net> <l03130303b43b69f1ad68@[147.233.159.109]>

* 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