Re: 'select where' using multiple columns. - Mailing list pgsql-sql

From Rob Kirkbride
Subject Re: 'select where' using multiple columns.
Date
Msg-id 42F3442E.9030906@rkcomputing.co.uk
Whole thread Raw
In response to Re: 'select where' using multiple columns.  (Ian Johannesen <ij@perlpimp.dk>)
List 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


pgsql-sql by date:

Previous
From: Hélder M. Vieira
Date:
Subject: Re: 'select where' using multiple columns.
Next
From: Richard Huxton
Date:
Subject: Re: Make C file for create type