Обсуждение: Help with SELECT and string

Поиск
Список
Период
Сортировка

Help with SELECT and string

От
Tomasz Misterka
Дата:
Hello,

I've got a problem with finding how to search database with string without
checking if string is "Chris" or "chris".

Now when I'm searching database for word "chris" i can't find word
"Chris" - how the SELECT should looks like?

Thanks in advance

Tomasz Misterka


Re: Help with SELECT and string

От
"Nick Fankhauser"
Дата:

> Now when I'm searching database for word "chris" i can't find word
> "Chris" - how the SELECT should looks like?


select name from nametable where lower(name) = 'chris';

or

select name from nametable where upper(name) = 'CHRIS';

-Nick

PS: I'd suggest taking general SQL questions like this to the pgsql-general
list.

---------------------------------------------------------------------
Nick Fankhauser

Business:
nickf@doxpop.com  Phone 1.765.965.7363  Fax 1.765.962.9788
doxpop  - Court records at your fingertips - http://www.doxpop.com/

Personal:
nick@fankhausers.com   http://www.fankhausers.com


Re: Help with SELECT and string

От
Stephan Szabo
Дата:
On Fri, 28 Sep 2001, Tomasz Misterka wrote:

> Hello,
>
> I've got a problem with finding how to search database with string without
> checking if string is "Chris" or "chris".
>
> Now when I'm searching database for word "chris" i can't find word
> "Chris" - how the SELECT should looks like?

Something like
select ... where lower(column) = 'chris'
should do what you want.  If you want to use indexes you'll need to
make an index on lower(column)