pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Johannesen <ij@perlpimp.dk>
To: pgsql-sql@postgresql.org
Cc: Rob Kirkbride <rob@rkcomputing.co.uk>
Subject: Re: 'select where' using multiple columns.
Date: Fri, 05 Aug 2005 12:24:19 +0200
Message-ID: <42F33E53.3000002@perlpimp.dk> (raw)
In-Reply-To: <42F33585.1090706@rkcomputing.co.uk>
References: <42F33585.1090706@rkcomputing.co.uk>

Hi.

Rob Kirkbride wrote:
> I've googled around for this but can't see a decent way of doing this :
> 
> 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%'   ??
> 
> Thanks for any help. Apologies if its a FAQ.

SELECT * FROM table WHERE forename_1 || ' ' || forename_2 || ' ' ||
surname LIKE '%String%';

-- 
Digitally Yours,

Ian Johannesen
web: http://perlpimp.dk/
msn: ij@perlpimp.dk
cel: +45 31 13 73 76

Attachments:

  smime.p7s (application/x-pkcs7-signature, 3.2K) download

view thread (5+ messages)  latest in thread

Message-ID: <42F33E53.3000002@perlpimp.dk>
Permalink:  ../42F33E53.3000002@perlpimp.dk/
Also on:    postgresql.org/message-id/42F33E53.3000002@perlpimp.dk

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ij@perlpimp.dk, rob@rkcomputing.co.uk
  Subject: Re: 'select where' using multiple columns.
  In-Reply-To: <42F33E53.3000002@perlpimp.dk>

* 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