Re: SELECT question

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Brian Avis <brian(dot)avis(at)searhc(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT question
Date: 2003-01-30 23:16:49
Message-ID: Pine.LNX.4.33.0301301615130.23648-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 30 Jan 2003, Brian Avis wrote:

> Assuming the data in the text field will resemble any of the following.
>
> Brian K. Avis
> Brian Avis
> Brian
>
> Or whatever combo.
>
>
> Brian Avis wrote:
>
> > I want to run a SELECT on a text field and match any of the following.
> >
> > brian
> > Brian
> > BRIAN
> >
> > Or any other combination. How do I tell SQL to ignore case when
> > doing a SELECT?

IF you're running 7.3.x, then you might need to use a tardis to go back in
time and make sure you used the C locale when you initdb'd your database.
If you didn't do that, then you'll need to backup your database and
reinitdb it with the C locale, then reload your data to make this work.
If you're on 7.2 and before, you won't have to reload your data to make
this next bit work...

Use a select with ilike:

select * from table where field ilike '%brian%';

should work.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-01-30 23:17:55 Re: SELECT question
Previous Message Brian Avis 2003-01-30 23:13:35 Re: SELECT question