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 <m.mazurek@multinet.pl>) |
Ответы |
Re: [SQL] arrays
|
Список | pgsql-sql |
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 <zakkr@zf.jcu.cz> 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 по дате отправления: