Re: [SQL] Tricky -to me!- SQL query.

From: Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl>
To: Stuart Rison <stuart(at)ludwig(dot)ucl(dot)ac(dot)uk>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Tricky -to me!- SQL query.
Date: 1999-01-12 13:48:03
Message-ID: Pine.GS4.4.02A.9901121442100.7827-100000@netra.gdansk.sprint.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> >
> >What about:
> >SELECT person FROM test WHERE fruit='pears' AND fruit='apples' AND
> >fruit='oranges';
> >or just
> >SELECT person FROM test WHERE fruit IN ('pears', 'apples','oranges');
> >
> >For me strange question - so I think I don't mean exactly what you do ;-)
>
> Hello Rem,
>
> Yes, there is a misunderstanding here, sorry about that, could be my posting.
> The first solution would return an empty table because there are no cases
> where fruit can be equal to two different things (the data in fruit are
> atomic so the field fruit can only ever be equal to one thing).
>
> The second of solutions answers the question "Who eats pears or eats apples
> or eats oranges?" but not the question "Who eats pears AND apples AND
> oranges?" (i.e. it would give the answers lucy, peter and stuart when the
> actual answers should be lucy and peter because, in the example table,
> stuart does not eat oranges).
>
Oh, no... I apologize for that - is here to hot or smth.
I must be ill - when I wrote fruit='smth' and fruit='smth_else' - it
couldn't be solution for that.
You're absolutely right.
It needs nested queries or function(which also should realize some
queries)
Rem

-------------------------------------------------------------------*------------
Remigiusz Sokolowski e-mail: rems(at)gdansk(dot)sprint(dot)pl * *
-----------------------------------------------------------------*****----------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Neil Burrows 1999-01-12 14:34:16 A path through a tree
Previous Message Stuart Rison 1999-01-12 13:41:57 Re: [SQL] Tricky -to me!- SQL query.