[plug] [OT] SQL column splitting

Bret Busby bret at busby.net
Mon Nov 15 19:41:51 WST 2004


On Mon, 15 Nov 2004, James Devenish wrote:

> 
> Hi,
> 
> For a set of rows matching certain criteria, I wish to 'split' each row
> into multiple rows based on a string delimiter in one of the columns. To
> illustrate the idea, imagine that I want like to split
> 
> ('1', 'A', 'x,y, z')
> ('2', 'B', 'i')
> 
> into
> 
> ('1', 'A', 'x')
> ('1', 'A', 'y')
> ('1', 'A', ' z')
> ('2', 'B', 'i')
> 
> Does anyone know of a non-horrific way to do this fairly portably in
> SQL? My mind seems to be blank on the matter at the moment.
> 
> 
> 

What DBMS is the backend?

Could it be done using Perl instead of SQL?

-- 
Bret Busby
Armadale
West Australia
..............

"So once you do know what the question actually is,
 you'll know what the answer means."
- Deep Thought,
  Chapter 28 of 
  "The Hitchhiker's Guide to the Galaxy:
  A Trilogy In Four Parts",
  written by Douglas Adams, 
  published by Pan Books, 1992 
....................................................




More information about the plug mailing list