[postgis-users] join multiple tables by id, and select all

Hugues François hugues.francois at inrae.fr
Thu Nov 19 03:29:05 PST 2020


Sounds more like a general PostgreSQL question rather than a PostGIS one. 

However, I guess you could build the list of unique variables as a string using queries on catalog tables embbeded in a PLPG function (or any other language depending on your work environment). 


De: "Shaozhong SHI" <shishaozhong at gmail.com> 
À: "PostGIS Users Discussion" <postgis-users at lists.osgeo.org> 
Envoyé: Jeudi 19 Novembre 2020 11:08:17 
Objet: [postgis-users] join multiple tables by id, and select all 

Hi, I tried the following for joining multiple tables by id, and select all into a new table. 
However, it will not work because id gets repeated. How to select all except one column? 

select a.*, b.*, c.*, d.* 
into new_table 
from a_table a 
join b_table b on [ http://a.id/ | a.id ] = [ http://b.id/ | b.id ] 
join c_table c on [ http://a.id/ | a.id ] = [ http://c.id/ | c.id ] 
join d_table d on [ http://a.id/ | a.id ] = [ http://d.id/ | d.id ] 

Looking forward to hearing from you. 



[Fichier texte:ATT00001] 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20201119/27f47d75/attachment.html>

More information about the postgis-users mailing list