Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5C240573E67 for ; Thu, 2 Feb 2012 01:17:07 -0400 (AST) Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rsp2g-0002lg-TJ for pgsql-sql@postgresql.org; Thu, 02 Feb 2012 05:17:07 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Rsp2T-0005v0-Cy for pgsql-sql@postgresql.org; Wed, 01 Feb 2012 21:16:53 -0800 Date: Wed, 1 Feb 2012 21:16:53 -0800 (PST) From: tiplip To: pgsql-sql@postgresql.org Message-ID: <1328159813393-5449642.post@n5.nabble.com> Subject: Multiple tables query on Mapserver MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 0.3 (/) X-Archive-Number: 201202/4 X-Sequence-Number: 36297 Hi all, I have a couple of tables with same structure but standing for different layers(1,2,3...) respectivle for Mapserver, table1 gid | id | name | address | post code | layer | geom -----------+------+----------+-------------+-----------+--------+------------ 1 1 'name11' 'address11' 102356 1 geom11 2 2 'name12' 'address12' 102356 1 geom12 - - 'name1-' 'address1-' 102356 1 geom1- table2 gid | id | name | address | post code | layer | geom -----------+------+----------+-------------+-----------+--------+------------ 1 1 'name21' 'address21' 102356 2 geom21 2 2 'name22' 'address22' 102356 2 geom22 - - 'name2-' 'address2-' 102356 2 geom2- table3 gid | id | name | address | post code | layer | geom -----------+------+----------+-------------+-----------+--------+------------ 1 1 'name31' 'address31' 102356 3 geom31 2 2 'name32' 'address32' 102356 3 geom32 - - 'name3-' 'address3-' 102356 3 geom3- I want to get query results from table1, 2, 3... if key word matches, say name like 'name' as follows: input 'name', results will be like table2 gid | id | name | address | post code | layer | geom -----------+------+----------+-------------+-----------+---------+------------ 1 1 'name11' 'address11' 102356 1 geom11 2 2 'name12' 'address12' 102356 1 geom12 3 3 'name21' 'address21' 102356 2 geom21 4 4 'name22' 'address22' 102356 2 geom22 5 5 'name31' 'address31' 102356 3 geom31 6 6 'name32' 'address32' 102356 3 geom32 - - --------- --------- ------- - - can I achieve that results with a single query sentence? and how? any good ideas will be appricated? thanks -- View this message in context: http://postgresql.1045698.n5.nabble.com/Multiple-tables-query-on-Mapserver-tp5449642p5449642.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com.