Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id D4ECB15B0F6C for ; Thu, 2 Feb 2012 01:25:01 -0400 (AST) Received: from nm11.bullet.mail.sp2.yahoo.com ([98.139.91.81]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1RspAK-0002qj-F6 for pgsql-sql@postgresql.org; Thu, 02 Feb 2012 05:25:01 +0000 Received: from [98.139.91.67] by nm11.bullet.mail.sp2.yahoo.com with NNFMP; 02 Feb 2012 05:24:47 -0000 Received: from [98.139.91.24] by tm7.bullet.mail.sp2.yahoo.com with NNFMP; 02 Feb 2012 05:22:47 -0000 Received: from [127.0.0.1] by omp1024.mail.sp2.yahoo.com with NNFMP; 02 Feb 2012 05:22:47 -0000 X-Yahoo-Newman-Id: 343688.2588.bm@omp1024.mail.sp2.yahoo.com Received: (qmail 48827 invoked from network); 2 Feb 2012 05:22:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:In-Reply-To:Mime-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Cc:X-Mailer:From:Subject:Date:To; b=ygw4ZSVDGHISMByZyD3Bv5wSHfVo2mRczNkFR2ns4aXfi7FmciENaPRTZBH9l0Smjc56e04yhSPV+hnFYCc4vlAj18m5DjqCh7SdqAnxaH7nybHxzVfa9NhPQK3hCFTW9K3VmIEeiAj6xprAvMeyhSePQWaRTi1qviMJN0H8EQs= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1328160167; bh=Tivuo6geQgbqRjdjz3s5IKkglDNS15MNujJ/UV2DRdU=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:In-Reply-To:Mime-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Cc:X-Mailer:From:Subject:Date:To; b=Ib+8kfvRi4RUpsrIIWT0ByuuytMQiXgKaPao2rFVF+9Ni6ldiz1hVNROtaEc092r8hvNVxxhHBcULzuAfouO4RTqS1rYhBrQ0V3M1JFslh28yOEPuAkiwNPfJVcf7GhKkgBh9hOmcMYLGpgHgBkMbhgrvQXmTvnsyan1oIU/j7A= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 8cND0GEVM1niPgHoOQzlzGF7ANXbXUhzR832_Izy.KNTWHt pf2FiPTBfGfv021f501KkHH0QooeyqYJt0ObD10tl1SCR5oZSh6E5LSUQgfV hiFgQHC.BF5JzZFPRvTuyf1C_krDBGABBDN8a1Axb8MpHMuTIElVPvWeWRSK ML9sCjKAT.4n_bfUhqBDGVjgoPpCIkUuzJ4.HP3M5wimJj7qO1zf8Kz4P9X5 t1E4xpXzgwz7T5JFK9KTpulBkWo1WAvSNEwwZlEqo2TkOdEjDd81Q209twHt sibWHn1a3wARshnLhQ8n.g_OTxvUPSN4DIJEFIxzNbKCwd3jkYgquhqshHu7 E18.erH1rDymhOBzEUleCsoG4c_STE80L1_MpCREdzzHBrhrLakRH2610m3T pRB_npQcvdnc0D_TrfKSB X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from [192.12.17.102] (polobo@24.93.23.188 with xymcookie) by smtp119-mob.biz.mail.gq1.yahoo.com with SMTP; 01 Feb 2012 21:22:46 -0800 PST References: <1328159813393-5449642.post@n5.nabble.com> In-Reply-To: <1328159813393-5449642.post@n5.nabble.com> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <59D2E8F6-962D-4DDC-96C0-5985AE0F4D9A@yahoo.com> Cc: "pgsql-sql@postgresql.org" X-Mailer: iPad Mail (9A405) From: David Johnston Subject: Re: Multiple tables query on Mapserver Date: Thu, 2 Feb 2012 00:22:46 -0500 To: tiplip X-Pg-Spam-Score: 0.0 (/) X-Archive-Number: 201202/5 X-Sequence-Number: 36298 On Feb 2, 2012, at 0:16, tiplip wrote: > Hi all, >=20 > I have a couple of tables with same structure but standing for different > layers(1,2,3...) respectivle for Mapserver, >=20 > table1 > gid | id | name | address | post code | layer = =20 > | geom > -----------+------+----------+-------------+-----------+--------+---------= --- > 1 1 'name11' 'address11' 102356 1= =20 > geom11 > 2 2 'name12' 'address12' 102356 1= =20 > geom12 > - - 'name1-' 'address1-' 102356 =20= > 1 geom1- >=20 > table2 > gid | id | name | address | post code | layer = =20 > | geom > -----------+------+----------+-------------+-----------+--------+---------= --- > 1 1 'name21' 'address21' 102356 2= =20 > geom21 > 2 2 'name22' 'address22' 102356 2= =20 > geom22 > - - 'name2-' 'address2-' 102356 2= =20 > geom2- >=20 >=20 > table3 > gid | id | name | address | post code | layer = =20 > | geom > -----------+------+----------+-------------+-----------+--------+---------= --- > 1 1 'name31' 'address31' 102356 3= =20 > geom31 > 2 2 'name32' 'address32' 102356 3= =20 > geom32 > - - 'name3-' 'address3-' 102356 =20= > 3 geom3- >=20 >=20 > I want to get query results from table1, 2, 3... if key word matches, say > name like 'name' as follows: >=20 > input 'name', results will be like >=20 > table2 > gid | id | name | address | post code | layer = =20 > | geom > -----------+------+----------+-------------+-----------+---------+--------= ---- > 1 1 'name11' 'address11' 102356 1= =20 > geom11 > 2 2 'name12' 'address12' 102356 1= =20 > geom12 > 3 3 'name21' 'address21' 102356 2= =20 > geom21 > 4 4 'name22' 'address22' 102356 2= =20 > geom22 > 5 5 'name31' 'address31' 102356 3= =20 > geom31 > 6 6 'name32' 'address32' 102356 3= =20 > geom32 > - - --------- --------- ------- -= =20 > - >=20 >=20 > can I achieve that results with a single query sentence? and how? > any good ideas will be appricated? >=20 > thanks >=20 >=20 The general method is to use "UNION" but not sure about the changing of the g= id and id values... David J.=