Re: [SQL] arrays

Поиск
Список
Период
Сортировка
Искать
От
Karel Zak - Zakkr
Тема
Re: [SQL] arrays
Дата
Msg-id
Pine.LNX.3.96.991202110153.29170A-100000@ara.zf.jcu.cz
Ответ на
arrays (Marcin Mazurek - Multinet SA - Poznan)
Список
Дерево обсуждения
Re: [SQL] Partial Search Wim Ceulemans <wim.ceulemans@nice.be>


On Wed, 1 Dec 1999, Marcin Mazurek - Multinet SA - Poznan wrote:

> Hi,
> I have a table: orders (id int, val INT4[][]);. The question is how to
> select in separate rows values from particular id?
> 
> example:
> insert into orders values(1,'{{1,1},{1,4},{2,3}}');
> select val from orders where id=1; gives me:
> val
> -------------------
> {{1,2},{1,4},{2,3}}
> 

If I good undertend you.. You want select values from a array in separate 
rows. Hmm see:

select o.val[1][1] from orders o where id=1 UNION ALL select o.val[1][2] 
from orders o where id=1;
val
--- 1 2
(2 rows)
And you have selected first dimension of the array now. But it is terrible 
method if you have a lot of dimensions and if you want search in array 
(for this is '*=' operator ..etc.).
						Karel



----------------------------------------------------------------------
Karel Zak               http://home.zf.jcu.cz/~zakkr/

Docs:        http://docs.linux.cz                    (big docs archive)	
Kim Project: http://home.zf.jcu.cz/~zakkr/kim/        (process manager)
FTP:         ftp://ftp2.zf.jcu.cz/users/zakkr/        (C/ncurses/PgSQL)
-----------------------------------------------------------------------


В списке pgsql-sql по дате отправления
От: Marcin Mazurek - Multinet SA - Poznan
Дата:
Сообщение: arrays
От: Marcin Mazurek - Multinet SA - Poznan
Дата:
Сообщение: Re: [SQL] arrays
FAQ