pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tarlika Elisabeth Schmitz <postgresql@numerixtechnology.de>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Tarlika Elisabeth Schmitz <postgresql@numerixtechnology.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: extracting words
Date: Wed, 23 Apr 2008 15:57:35 +0100
Message-ID: <20080423155735.2755b5c7@dick.coachhouse> (raw)
In-Reply-To: <20080423131303.GE4768@alvh.no-ip.org>
References: <20080422222504.56bdb06d@dick.coachhouse>
	<20080423131303.GE4768@alvh.no-ip.org>

On Wed, 23 Apr 2008 09:13:03 -0400
Alvaro Herrera <alvherre@commandprompt.com> wrote:

> Tarlika Elisabeth Schmitz wrote:
> 
> > I need to extract the words from department_name and product_name
> > (words are separated by spaces) and get something like:
> > 
> > 1 cakes
> > 1 desserts
> > 1 apple
> > 1 crumble
> > 2 cakes
> > 2 desserts
> > 2 cheese
> > 2 cake
> > 3 starters
> > 3 soups
> > 3 french
> > 3 onion
> > 3 soup
> 
> regexp_split_to_table is handy (8.3 only):
> 
> select pk, regexp_split_to_table(product_name, '[& ]+') from products
> union
> select pk, regexp_split_to_table(dept_name, '[& ]+') from departments;
> 
> Add joins as desired.


This is neat!
Unfortunately, on the machine that I need this, we are running 7.4.

--


Best Regards,

Tarlika Elisabeth Schmitz


A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad? 



view thread (5+ messages)  latest in thread

Message-ID: <20080423155735.2755b5c7@dick.coachhouse>
Permalink:  ../20080423155735.2755b5c7@dick.coachhouse/
Also on:    postgresql.org/message-id/20080423155735.2755b5c7@dick.coachhouse

 · 

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: postgresql@numerixtechnology.de, alvherre@commandprompt.com
  Subject: Re: extracting words
  In-Reply-To: <20080423155735.2755b5c7@dick.coachhouse>

* 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