pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedignore single character in SELECT query?
3+ messages / 3 participants
[nested] [flat]
* ignore single character in SELECT query?
@ 2005-04-13 02:46 jspring@gmail.com
0 siblings, 2 replies; 3+ messages in thread
From: jspring@gmail.com @ 2005-04-13 02:46 UTC (permalink / raw)
To: pgsql-sql
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?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ignore single character in SELECT query?
@ 2005-04-13 04:56 Greg Stark <gsstark@mit.edu>
parent: jspring@gmail.com
1 sibling, 0 replies; 3+ messages in thread
From: Greg Stark @ 2005-04-13 04:56 UTC (permalink / raw)
To: jspring@gmail.com; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ignore single character in SELECT query?
@ 2005-04-13 04:58 Dinesh Pandey <dpandey@secf.com>
parent: jspring@gmail.com
1 sibling, 0 replies; 3+ messages in thread
From: Dinesh Pandey @ 2005-04-13 04:58 UTC (permalink / raw)
To: jspring@gmail.com; pgsql-sql
Use
--------
select replace(quote_literal('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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-04-13 04:58 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-13 02:46 ignore single character in SELECT query? jspring@gmail.com
2005-04-13 04:56 ` Greg Stark <gsstark@mit.edu>
2005-04-13 04:58 ` Dinesh Pandey <dpandey@secf.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox