From: | "Rob Hoffman" <robh100(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: simple query question |
Date: | 2001-12-17 02:25:31 |
Message-ID: | vIcT7.12895$ED6.2117724@typhoon.neo.rr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
How about
update blah where upper(actor || ' - ' || movie) = upper('jack
nicholson - one flew over the cookoo's nest')
I changed LIKE to = since it looks like you are really wanting something of
an exact match. Like is usually used in conjuction with the % sign for
pattern matches.
I believe Postgres concatinated with the double || operator but I do do that
often and didn't verify the statement, but it should get you in the
ballpark.
Rob
"Dan Maher" <dan(dot)maher(at)home(dot)com> wrote in message
news:XbcT7(dot)72507$py4(dot)34479716(at)news2(dot)nash1(dot)tn(dot)home(dot)com(dot)(dot)(dot)
> Thanks in advance:
>
> I want to do a particular type of pattern matching in a string, but am not
a
> regexp guru. Can ya help?
>
> I want to find a row in a table that has a column that matches a string
like
>
> "jack nicholson - one flew over the cuckoo's nest"
>
> but the columns I have are:
>
> actor movie
> ------ --------
> jack nicholson One flew over the cuckoo's nest
>
> What I have been trying is
>
> UPDATE blah WHERE actor LIKE
> "jack nicholson - one flew over the cuckoo's nest"
> OR movie LIKE
> "jack nicholson - one flew over the cuckoo's nest"
>
> of course that doesn't work. So the column in the table is a substring of
> the search string. Parsing up the search string seems like the hard way to
> do it, is there an easy way to see if a column's value is a subset of the
> query string?
>
> <sql idiot mode>
> Also, if there is a DB-independent way to do this without a specific
> PostgreSQL operator, that would be ideal.
> </sql idiot mode>
>
> Many thanks,
> Dan
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Darren Ferguson | 2001-12-17 03:08:10 | Re: Perl DBI, PostgreSQL performance question |
Previous Message | Dan Maher | 2001-12-17 01:50:47 | simple query question |