Querying for strings that match after prefix

From: "badlydrawnbhoy" <badlydrawnbhoy(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Querying for strings that match after prefix
Date: 2006-06-02 09:47:22
Message-ID: 1149241642.145349.275530@j55g2000cwa.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I hope this is the right forum for this, but please correct me if
somewhere else is more appropriate.

I need to locate all the entries in a table that match , but only after
a number of characters have been ignored. I have a table of email
addresses, and someone else has erroneously entered some addresses
prefixed with 'mailto:', which I'd like to ignore.

An example would be: john(dot)smith(at)smiths(dot)com should match
mailto:john(dot)smith(at)smiths(dot)com

I've tried the following

select address
from people
where address = (select replace(address, 'mailto:', '') from people);

which gives me the error

ERROR: more than one row returned by a subquery used as an expression

I'm running on PostgreSQL 7.4.7

Thanks in advance,

BBB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marin Alonso, David 2006-06-02 11:42:23 Migrate Postgres 7.2 to Postgres 8.1
Previous Message Chris Velevitch 2006-06-02 09:34:19 create view problem