RE: Simple Question: Case sensitivity

From: "Hancock, David (DHANCOCK)" <DHANCOCK(at)arinc(dot)com>
To: "'Abe '" <abe(at)fish(dot)tm>, "'pgsql-general(at)postgresql(dot)org '" <pgsql-general(at)postgresql(dot)org>
Subject: RE: Simple Question: Case sensitivity
Date: 2000-12-10 12:48:24
Message-ID: 09328AED5429D311A3000008C7911B1007CF7CAC@exanpmb1.arinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Abe: It's an SQL thing or a scripting thing. It's probably easiest and
safest in the SQL:

select firstname, surname from employees
where upper(firstname) like upper('%$criteria%') or
upper(surname) like upper('%$criteria%')

That is, force the column and the search string to uppercase befor
comparing, and it won't matter how it's stored in the database.

Cheers!
--
David Hancock

-----Original Message-----
From: Abe
To: pgsql-general(at)postgresql(dot)org
Sent: 12/10/00 7:23 AM
Subject: [GENERAL] Simple Question: Case sensitivity

This is probably an easy question for most but here goes:

I am using PHP3 and postgres 6.5

I am trying to do a search on a peoples database and it works fine
except
for the fact that I want to make it case insensitive as some in the
database
are Smith and some are jones. Is this a scripting thing or can it be
done
in my query.

Here is the query:

$sql = "select surname, firstname, title, company, worktel, ext,
hometel,
mobile, email, emailtwo from employees where firstname like
'%$criteria%' or
surname like '%$criteria%'";

Thanks in advance,
Abe

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abe 2000-12-10 13:08:50 Re: Simple Question: Case sensitivity
Previous Message Abe 2000-12-10 12:23:37 Simple Question: Case sensitivity