adqlsimbad

How to concat rows into a single row with ADQL


How can one concatinate several rows into one row using ADQL (Astronomical Data Query Language)?

What I am trying to do, is to select all alternative names of an object and concate them like this:

M 13
Hercules cluster

to

M 13, Hercules cluster

The query I am using at the moment (which returns multiple rows of the same object, one for each alternative name) on 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'

Try it here: http://simbad.u-strasbg.fr/simbad/sim-tap


Solution

  • Figured it out:

    Turns out one can just use the plural of the column name:

    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'