From: | "Gregory Wood" <gregw(at)com-stock(dot)com> |
---|---|
To: | "Dan Maher" <dan(dot)maher(at)home(dot)com> |
Cc: | "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: simple query question |
Date: | 2001-12-24 16:17:06 |
Message-ID: | 00eb01c18c96$91012940$7889ffcc@comstock.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> 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
You should be able to concatenate both fields together (with the spaces and
dash) when doing your search:
UPDATE blah WHERE actor||' - '||movie = "jack nicholson - one flew over the
cuckoo's nest";
Remember, it's just a comparison operator... it just compares what's on the
left side to the right, not just a single column with another value.
> <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>
I believe || is SQL standard for concatenation, so you should be fine using
that.
Greg
From | Date | Subject | |
---|---|---|---|
Next Message | Doug McNaught | 2001-12-24 17:07:23 | Re: Database recovery |
Previous Message | Rob Arnold | 2001-12-24 15:35:08 | Re: PostgreSQL DBI DBD::Pg Access Problem |