Re: How to split an array-column?

Поиск
Список
Период
Сортировка
От Venky Kandaswamy
Тема Re: How to split an array-column?
Дата
Msg-id 776CCF725798BE4ABEC2521B9AEDBB3550F7464D@BY2PRD0511MB429.namprd05.prod.outlook.com
обсуждение исходный текст
Ответ на How to split an array-column?  (Andreas <maps.on@gmx.net>)
Ответы Re: How to split an array-column?  (Andreas <maps.on@gmx.net>)
Список pgsql-sql
You can try

select id, unnest(array_col) from table

....
________________________________________

Venky Kandaswamy

Principal Engineer, Adchemy Inc.

925-200-7124

________________________________________
From: pgsql-sql-owner@postgresql.org [pgsql-sql-owner@postgresql.org] on behalf of Andreas [maps.on@gmx.net]
Sent: Monday, March 18, 2013 12:13 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] How to split an array-column?

Hi,

I've got a table to import from csv that has an array-column like:

import ( id, array_col, ... )

Those arrays look like ( 42,  ";4941;4931;4932", ... )
They can have 0 or any number of elements separated by ;

So I'd need a result like this:
42, 4941
42, 4931
42, 4932

How would I get this?


--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql





В списке pgsql-sql по дате отправления:

Предыдущее
От: Andreas
Дата:
Сообщение: How to split an array-column?
Следующее
От: Andreas
Дата:
Сообщение: Re: How to split an array-column?