0

如何使用 ADQL(天文数据查询语言)将多行连接成一行?

我想要做的是选择一个对象的所有替代名称并将它们连接起来,如下所示:

M 13
Hercules cluster

M 13, Hercules cluster

我目前在 SIMBAD 上使用的查询(返回同一对象的多行,每个替代名称一个):

-- Basic data from an object given one of its identifiers.
SELECT basic.OID,
       RA,
       DEC,
       main_id AS "Name",
       OTYPEDEF.otype_longname AS "Type",
       OTYPEDEF.otype_shortname AS "TypeShort",
       coo_bibcode AS "Coord Reference",
       nbref AS "NbReferences",
       plx_value as "Parallax",
       rvz_radvel as "Radial velocity",
       galdim_majaxis,
       galdim_minaxis,
       galdim_angle AS "Galaxy ellipse angle",
       id1.id
FROM basic JOIN ident ON ident.oidref = oid
LEFT JOIN OTYPEDEF ON OTYPEDEF.otype = basic.otype
LEFT JOIN ident AS id1 ON id1.oidref = basic.OID
WHERE ident.id = 'M13'

在这里试试:http: //simbad.u-strasbg.fr/simbad/sim-tap

4

1 回答 1

1

弄清楚了:

原来可以只使用列名的复数形式:

SELECT  TOP 100  "public".ids.ids
FROM "public".basic
JOIN "public".ids ON "public".basic.oid = "public".ids.oidref
WHERE      "public".basic.main_id = 'm13' 
于 2019-03-08T15:31:16.103 回答