[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] join multiple tables by id, and select all
From: Hugues =?utf-8?Q?Fran=C3=A7ois?= <hugues.francois () inrae ! fr>
Date: 2020-11-19 11:29:05
Message-ID: 150145801.362938.1605785345350.JavaMail.zimbra () inrae ! fr
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi,
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).
Regards,
Hug
De: "Shaozhong SHI" <shishaozhong@gmail.com>
À: "PostGIS Users Discussion" <postgis-users@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.
Regards,
David
[Fichier texte:ATT00001]
[Attachment #5 (text/html)]
<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>
[Attachment #6 (text/plain)]
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic