Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C99C62E2E74 for ; Fri, 4 Jan 2008 13:53:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 60627-06 for ; Fri, 4 Jan 2008 13:53:35 -0400 (AST) Received: from BRUBLUmx13.mactelecom.net (BRUBLUmx13.mactelecom.net [217.64.240.20]) by postgresql.org (Postfix) with ESMTP id A94AB2E2DBE for ; Fri, 4 Jan 2008 13:53:35 -0400 (AST) Received: by BRUBLUmx13.mactelecom.net (Postfix, from userid 505) id 45B09210392; Fri, 4 Jan 2008 19:53:34 +0200 (EET) Received: from smtp.eurofer.be (217.64.254.218.mactelecom.net [217.64.254.218]) by BRUBLUmx13.mactelecom.net (Postfix) with ESMTP id DD9E2210370 for ; Fri, 4 Jan 2008 19:53:33 +0200 (EET) Received: from [192.168.5.6] by smtp.eurofer.be with esmtp (Exim 4.63) (envelope-from ) id 1JAqjd-0006cJ-Kf for pgsql-admin@postgresql.org; Fri, 04 Jan 2008 18:53:39 +0100 Message-ID: <477E7297.7050509@eurofer.be> Date: Fri, 04 Jan 2008 18:53:27 +0100 From: Guy Deleeuw User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: pgsql-admin@postgresql.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam_score: -3.8 X-SA-Exim-Connect-IP: 192.168.5.6 X-SA-Exim-Mail-From: G.De_Leeuw@eurofer.be Subject: how to array and other select X-SA-Exim-Scanned: Yes (on smtp.eurofer.be) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/67 X-Sequence-Number: 27841 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