Thread: RE: SQL Syntax

RE: SQL Syntax

From
"Jackson, DeJuan"
Date:
The error that you are running into is it appears you believe that || is
an OR operator.  In Postgres (and I believe the SQL standard) the '||'
operator is used for string concatenation.
I believe the query you are seeking is:
   select title from book where title ~* 'world|nation'
    -DEJ;
> -----Original Message-----
> I am trying to use something like the following in 6.4.2:
>
>   select title from book where title ~* ('world' || 'nation');
>
> Though one of your emails to the 'postgresql' list uses something
> similar, the above returns no matches (even though some records
> contain both strings).
>
> Any ideas?
>
> I'm trying to find a shorter form than
>
>   select title from book where title ~* 'world' or title ~* 'nation';
>
>
> Thanks for any help,
>
> -Prof Kenneth H Jacker       khj@cs.appstate.edu
> -Computer Science Dept       www.cs.appstate.edu/~khj
> -Appalachian State Univ
> -Boone, NC  28608  USA
>