Re: 'select where' using multiple columns.

From: daq <daq(at)ugyvitelszolgaltato(dot)hu>
To: Rob Kirkbride <rob(at)rkcomputing(dot)co(dot)uk>
Cc: Pgsql-sql(at)postgresql(dot)org
Subject: Re: 'select where' using multiple columns.
Date: 2005-08-05 10:37:52
Message-ID: 36189874171.20050805123752@ugyvitelszolgaltato.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

RK> Hi,

RK> I've googled around for this but can't see a decent way of doing this :

RK> I've got a persons name which is being stored say in 3 columns :-
RK> Title, Forename_1, Forename_2, Surname. I want to allow a search say for
RK> 'John Smith'. Problem is I can't just break it up into forename and
RK> surname because I won't also know.
RK> Is there a way to do something like a
RK> 'select * where forename_1,forename_2,surname like '%String%' ??

RK> Thanks for any help. Apologies if its a FAQ.

RK> Rob

RK> ---------------------------(end of broadcast)---------------------------
RK> TIP 5: don't forget to increase your free space map settings

Try this way:

select * .... where forename_1||' '||forename_2||' '||surname like '%String%'

or

select * .... where forename_1||' '||forename_2||' '||surname~'String'

DAQ

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Hélder M. Vieira 2005-08-05 10:43:19 Re: 'select where' using multiple columns.
Previous Message Ian Johannesen 2005-08-05 10:24:19 Re: 'select where' using multiple columns.