<html><body><div style="font-family: garamond,new york,times,serif; font-size: 12pt; color: #000000"><div>Hi,</div><div><br data-mce-bogus="1"></div><div>Sounds more like a general PostgreSQL question rather than a PostGIS one.</div><div><br data-mce-bogus="1"></div><div>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).</div><div><br data-mce-bogus="1"></div><div>Regards,</div><div>Hug</div><div><br></div><div data-marker="__SIG_PRE__"><div><p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: #fdfcfa;"><br data-mce-bogus="1"></p></div></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>De: </b>"Shaozhong SHI" <shishaozhong@gmail.com><br><b>À: </b>"PostGIS Users Discussion" <postgis-users@lists.osgeo.org><br><b>Envoyé: </b>Jeudi 19 Novembre 2020 11:08:17<br><b>Objet: </b>[postgis-users] join multiple tables by id, and select all<br></div><div><br></div><div data-marker="__QUOTED_TEXT__"><div dir="ltr">Hi, I tried the following for joining multiple tables by id, and select all into a new table.<br><div>However, it will not work because id gets repeated.  How to select all except one column?<br><br><div>select a.*, b.*, c.*, d.*<br>into new_table<br>from a_table a<br>join b_table b on <a href="http://a.id" target="_blank">a.id</a>=<a href="http://b.id" target="_blank">b.id</a><br>join c_table c on <a href="http://a.id" target="_blank">a.id</a>=<a href="http://c.id" target="_blank">c.id</a><br>join d_table d on <a href="http://a.id" target="_blank">a.id</a>=<a href="http://d.id" target="_blank">d.id</a></div><br><div>Looking forward to hearing from you.</div><br><div>Regards,</div><br><div>David<br><br></div></div></div>
<br><br>[Fichier texte:ATT00001]<br></div></div></body></html>