Re: [SQL] problems with array

2005-11-30 Thread george young
On Sat, 15 Oct 2005 08:49:15 + "paperinik 100" <[EMAIL PROTECTED]> threw this fish to the penguins: > PostgreSQL is 7.4.7. > > My first table > CREATE TABLE tb_cat ( > id INTEGER, > desc text > ); > INSERT INTO tb_cat VALUES (10, 'cat10'); > INSERT INTO tb_cat VALUES (20, 'cat20'); > INSERT I

Re: [SQL] problems with array

2005-10-18 Thread Matthew Peter
Ya, I didn't test it. The error message was expecting an integer not an array, so coverting it to a list crossed my mind 'assuming' the subselect 'could' return a string of integers for the IN clause. Oh well. I'm glad there's people like you test it. --- Michael Fuhr <[EMAIL PROTECTED]> wrote:

Re: [SQL] problems with array

2005-10-18 Thread Michael Fuhr
On Tue, Oct 18, 2005 at 08:09:48PM -0700, Matthew Peter wrote: > Not sure if you got this figured out but I think > > SELECT * from tb_cat WHERE id IN (SELECT > array_to_string(cat,',') as cat FROM tb_array WHERE > id=1); > > is what your looking for? I doubt it, considering that it doesn't work

Re: [SQL] problems with array

2005-10-18 Thread Matthew Peter
Not sure if you got this figured out but I think SELECT * from tb_cat WHERE id IN (SELECT array_to_string(cat,',') as cat FROM tb_array WHERE id=1); is what your looking for? --- paperinik 100 <[EMAIL PROTECTED]> wrote: > PostgreSQL is 7.4.7. > > My first table > CREATE TABLE tb_cat ( > id I

[SQL] problems with array

2005-10-18 Thread paperinik 100
PostgreSQL is 7.4.7. My first table CREATE TABLE tb_cat ( id INTEGER, desc text ); INSERT INTO tb_cat VALUES (10, 'cat10'); INSERT INTO tb_cat VALUES (20, 'cat20'); INSERT INTO tb_cat VALUES (30, 'cat30'); My second table CREATE TABLE tb_array( id INTEGER, cat INTEGER[] ); INSERT INTO tb_array V