|
Home > Archive > PostgreSQL SQL > April 2005 > ignore single character in SELECT query?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ignore single character in SELECT query?
|
|
| jspring@gmail.com 2005-04-13, 3:24 am |
| Given select criteria "dont" I would like to return rows with values
"don't". Or similarily I want rows with "they're" given input criteria
"theyre".
So basically I want to ignore a single character (the apostrophe
character), anywhere in the middle of my search word, in selecting
results. How can I do this?
| |
| Greg Stark 2005-04-13, 3:24 am |
|
jspring@gmail.com writes:
> So basically I want to ignore a single character (the apostrophe
> character), anywhere in the middle of my search word, in selecting
> results. How can I do this?
WHERE replace(name,'''',''
) like '%dont%'
Beware of quoting issues if "dont" is coming from user supplied inputs.
--
greg
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| Dinesh Pandey 2005-04-13, 3:24 am |
| Use
--------
select replace(quote_litera
l('don't'), ''', '');
Or
select replace(quote_ident(
myColumnName, ''', '');
Thanks
Dinesh Pandey
-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of jspring@gmail.com
Sent: Wednesday, April 13, 2005 8:16 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] ignore single character in SELECT query?
Given select criteria "dont" I would like to return rows with values
"don't". Or similarily I want rows with "they're" given input criteria
"theyre".
So basically I want to ignore a single character (the apostrophe
character), anywhere in the middle of my search word, in selecting
results. How can I do this?
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
|
|
|
|
|