pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tk421 <vrobador@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Pattern Matchig
Date: Tue, 08 Apr 2008 19:14:24 +0200
Message-ID: <47FBA7F0.3000300@gmail.com> (raw)

    Hello everybody

    I'm trying to make a query in a table to find the records who 
contains a full word 'im looking for.

    Here is an example about i'm trying

    code      text
    1            foobar
    2            xxxx foobar
    3            xxxx foobar yyyyy
    4            foobar xxxx
    5            foobars
    6            foobar.
    7            xxxx foobar.

    What i want is to find foobar (records 1, 2, 3 and 4) but no foobars 
(record 5). If i try

       SELECT code FROM table WHERE text LIKE '%foobar%'

    The result is 1, 2, 3, 4, 5, 6, 7.  But if I try

       SELECT code FROM table WHERE text LIKE '% foobar %'

    The result is only record number 3. How can i search the entire 
FOOBAR word? The result wanted must be all, excepting 5.

    Thank you very much.

    PD: Sorry about my english



view thread (3+ messages)  latest in thread

Message-ID: <47FBA7F0.3000300@gmail.com>
Permalink:  ../47FBA7F0.3000300@gmail.com/
Also on:    postgresql.org/message-id/47FBA7F0.3000300@gmail.com

 · 

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: vrobador@gmail.com
  Subject: Re: Pattern Matchig
  In-Reply-To: <47FBA7F0.3000300@gmail.com>

* 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