Re: [GENERAL] SQL Where Statement

From: Marin D <marin(at)cybernet(dot)bg>
To: Michael <michael(at)wizard(dot)ca>
Cc: General Postgres Questions <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] SQL Where Statement
Date: 1998-06-06 14:42:13
Message-ID: Pine.LNX.3.96.980606173321.6416C-100000@server.iclub.techno-link.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 6 Jun 1998, Michael wrote:

>
> I am trying to do a select with a WHERE clause excluding all fields that
> don't start with 'A'..'Z'
>
> Something in the form of
> WHERE lastname
> NOT LIKE ('A'..'Z') AND
> NOT LIKE ('a'..'z')

SELECT *
FROM somewhere
WHERE lastname !~ '[A-Z]' AND lastname !~ '[a-z]';

will INCLUDE the fields that *don't* start with A-Za-z while

SELECT *
FROM somewhere
WHERE lastname ~ '[A-Z]' AND lastname ~ '[a-z]';

will EXCLUDE the fields that *don't* start with A-Za-z

Hope this helps...

Marin

-= Why do we need gates in a world without fences? =-

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 1998-06-06 15:27:44 Re: [GENERAL] Re: [HACKERS] NEW POSTGRESQL LOGOS
Previous Message Marin D 1998-06-06 14:25:26 Re: [GENERAL] A couple of LIBPQ questions