From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | John Scalia <jayknowsunix(at)gmail(dot)com> |
Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: string not equal query, postgresql 9.4.4 |
Date: | 2015-09-17 02:23:11 |
Message-ID: | CAKFQuwb5KheE2wbh+ygK6vRP3sWem-Jd30mxUX2OVKXMcnzkzg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Wed, Sep 16, 2015 at 9:14 PM, John Scalia <jayknowsunix(at)gmail(dot)com> wrote:
> Hi all,
>
> Having a bit of a head-scratching problem. I'm writing a query where I
> want to output only distinct rows where one char(4) field does not equal a
> specific value. Something like:
>
> select distinct testname where result <> 'PASS"; #i.e., only the FAIL
> or WARN tests
>
> I've tried several different variants like "!~", "not like ('PASS')", "is
> distinct from 'PASS'", and so forth, but obviously I'm missing something as
> every row is being output not
> just the ones which do not equal PASS. What would be the correct syntax
> for this in a 9.4.4 database?
> --
> Jay
>
WITH vals (v) AS (
VALUES ('PASS'::char(4)), ('FAIL'::char(4))
)
SELECT
DISTINCT
*
FROM vals
WHERE v <> 'PASS'::char(4);
Since this is basically what you did you apparently either do not
understand your data completely or you have failed to convey necessary
information to the audience whom you are asking for help.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Albe Laurenz | 2015-09-17 08:21:23 | Re: string not equal query, postgresql 9.4.4 |
Previous Message | John Scalia | 2015-09-17 01:14:25 | string not equal query, postgresql 9.4.4 |