From: | Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | Marcin Mazurek - Multinet SA - Poznan <m(dot)mazurek(at)multinet(dot)pl> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] arrays |
Date: | 1999-12-02 10:20:00 |
Message-ID: | Pine.LNX.3.96.991202110153.29170A-100000@ara.zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)zf(dot)jcu(dot)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)
-----------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Marcin Mazurek - Multinet SA - Poznan | 1999-12-02 11:01:15 | Re: [SQL] arrays |
Previous Message | Marcin Mazurek - Multinet SA - Poznan | 1999-12-01 22:34:02 | arrays |