pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guy Deleeuw <G.De_Leeuw@eurofer.be>
To: pgsql-admin@postgresql.org
Subject: how to array and other select
Date: Fri, 04 Jan 2008 18:53:27 +0100
Message-ID: <477E7297.7050509@eurofer.be> (raw)

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




Message-ID: <477E7297.7050509@eurofer.be>
Permalink:  ../477E7297.7050509@eurofer.be/
Also on:    postgresql.org/message-id/477E7297.7050509@eurofer.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: G.De_Leeuw@eurofer.be
  Subject: Re: how to array and other select
  In-Reply-To: <477E7297.7050509@eurofer.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox