Re: 'select where' using multiple columns.

From: Rob Kirkbride <rob(at)rkcomputing(dot)co(dot)uk>
To: ij(at)perlpimp(dot)dk
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: 'select where' using multiple columns.
Date: 2005-08-05 10:49:18
Message-ID: 42F3442E.9030906@rkcomputing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ian Johannesen wrote:

>Hi.
>
>Rob Kirkbride wrote:
>
>
>>I've got a persons name which is being stored say in 3 columns :-
>>Title, Forename_1, Forename_2, Surname. I want to allow a search say for
>>'John Smith'. Problem is I can't just break it up into forename and
>>surname because I won't also know.
>>Is there a way to do something like a
>>'select * where forename_1,forename_2,surname like '%String%' ??
>>
>>
>>
>SELECT * FROM table WHERE forename_1 || ' ' || forename_2 || ' ' ||
>surname LIKE '%String%';
>
>
>
Thanks for the quick response. I've tried that and it works fine. Thanks
a lot and thanks to Daq and Helder.

Rob

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Henry Ortega 2005-08-05 16:28:24 sum but not grouped by?
Previous Message Richard Huxton 2005-08-05 10:48:06 Re: Make C file for create type