Re: except command

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "olivier boissard" <olivier(dot)boissard(at)cerene(dot)fr>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: except command
Date: 2007-08-13 18:07:43
Message-ID: 46C0579F.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>>> On Mon, Aug 13, 2007 at 12:50 PM, in message <46C099F6(dot)8050002(at)cerene(dot)fr>,
olivier boissard <olivier(dot)boissard(at)cerene(dot)fr> wrote:
> I tried to use the except command in postgresql 8.1
> I don't understand as it works
> When I read doc , I understand that it was like a difference betwwen two
> queries

That isn't how I read it:

"The EXCEPT operator returns the rows that are in the first result set
but not in the second."

( http://www.postgresql.org/docs/8.1/interactive/sql-select.html )

Are you seeing something different?

This gets me all the eye color codes that don't start with the letter 'B'.
(There are of course easier ways to get that...)

bigbird=> select * from "EyeColorCode" except select * from "EyeColorCode" where "eyeColorCode" like 'B%';
eyeColorCode | descr | isActive | dotEyeColorCode
--------------+-----------------+----------+-----------------
GRN | Green | t | GRN
GRY | Gray | t | GRY
HAZ | Hazel | t | HAZ
MAR | Maroon | t | MAR
MUL | Multicolored | t | DIC
PNK | Pink | t | PNK
XXX | Unknown | t | UNK
(7 rows)

-Kevin

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Steve Holdoway 2007-08-13 18:13:58 Re: except command
Previous Message olivier boissard 2007-08-13 17:50:46 except command