pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: daq <daq@ugyvitelszolgaltato.hu>
To: Rob Kirkbride <rob@rkcomputing.co.uk>
Cc: Pgsql-sql@postgresql.org
Subject: Re: 'select where' using multiple columns.
Date: Fri, 5 Aug 2005 12:37:52 +0200
Message-ID: <36189874171.20050805123752@ugyvitelszolgaltato.hu> (raw)
In-Reply-To: <42F33585.1090706@rkcomputing.co.uk>
References: <42F33585.1090706@rkcomputing.co.uk>



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




view thread (5+ messages)  latest in thread

Message-ID: <36189874171.20050805123752@ugyvitelszolgaltato.hu>
Permalink:  ../36189874171.20050805123752@ugyvitelszolgaltato.hu/
Also on:    postgresql.org/message-id/36189874171.20050805123752@ugyvitelszolgaltato.hu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: daq@ugyvitelszolgaltato.hu, rob@rkcomputing.co.uk
  Subject: Re: 'select where' using multiple columns.
  In-Reply-To: <36189874171.20050805123752@ugyvitelszolgaltato.hu>
  References: <42F33585.1090706@rkcomputing.co.uk> <36189874171.20050805123752@ugyvitelszolgaltato.hu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox