X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 61A8452909 for ; Fri, 5 Aug 2005 07:49:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69323-10 for ; Fri, 5 Aug 2005 10:49:22 +0000 (GMT) Received: from mra01.ch.as12513.net (mra01.ch.as12513.net [82.153.252.23]) by svr1.postgresql.org (Postfix) with ESMTP id 8FA78528B4 for ; Fri, 5 Aug 2005 07:49:21 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mra01.ch.as12513.net (Postfix) with ESMTP id 88EF728CAA9; Fri, 5 Aug 2005 11:49:23 +0100 (BST) Received: from mra01.ch.as12513.net ([127.0.0.1]) by localhost (mra01.ch.as12513.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19656-01-70; Fri, 5 Aug 2005 11:49:21 +0100 (BST) Received: from [10.0.0.151] (unknown [81.5.146.249]) by mra01.ch.as12513.net (Postfix) with ESMTP id AB72128CA9B; Fri, 5 Aug 2005 11:49:18 +0100 (BST) Message-ID: <42F3442E.9030906@rkcomputing.co.uk> Date: Fri, 05 Aug 2005 11:49:18 +0100 From: Rob Kirkbride User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ij@perlpimp.dk Cc: pgsql-sql@postgresql.org Subject: Re: 'select where' using multiple columns. References: <42F33585.1090706@rkcomputing.co.uk> <42F33E53.3000002@perlpimp.dk> In-Reply-To: <42F33E53.3000002@perlpimp.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Eclipse VIRUSshield at eclipse.net.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200508/25 X-Sequence-Number: 22253 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