how to array and other select

From: Guy Deleeuw <G(dot)De_Leeuw(at)eurofer(dot)be>
To: pgsql-admin(at)postgresql(dot)org
Subject: how to array and other select
Date: 2008-01-04 17:53:27
Message-ID: 477E7297.7050509@eurofer.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello the list

Before all : happy new year for all.

I Don't know how can I write a sql select.

I have 2 tables :
One with an array of codes

and another with a code

I try to retrieve the array of codes from the first table and return
only the codes existing on the second table
If possible I search also to retrieve 2 others fields from the first
table that corresponds to the code array value

I have :
SELECT tcode[idx] AS code FROM (SELECT tcode,
generate_series(array_lower(tcode,1), array_upper(tcode,1)) AS idx FROM
table_cat_origin WHERE code=120 ) asdf
UNION
SELECT code FROM table_f260_cat_origin
;

but the number of returned rows are incorrect.

Anyone can help me ?

Thanks in advance

Guy

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Sullivan 2008-01-04 18:16:36 Re: Vacuum taking an age
Previous Message Scott Marlowe 2008-01-04 17:02:33 Re: When does VACUUM FULL not clean out all deleted data?