3 | | > {{{#!sql |
4 | | > SELECT t.id as id, |
5 | | > t.summary as summary, |
6 | | > group_concat(a.description,", ") as "file descriptions", |
7 | | > group_concat(a.filename,", ") as files |
8 | | > FROM attachment a |
9 | | > INNER JOIN ticket t |
10 | | > ON a.id == t.id |
11 | | > WHERE a.type=="ticket" |
12 | | > GROUP BY t.id |
13 | | > }}} |
14 | | > |
15 | | > Or to get one table per ticket with one row per attachment: |
16 | | > {{{#!sql |
17 | | > SELECT a.filename AS id, "attachment" AS _realm, |
18 | | > "ticket" AS _parent_realm, t.id AS _parent_id, |
19 | | > a.description as description, |
20 | | > a.size as size, |
21 | | > "#" || t.id || " " || t.summary as __group__, |
22 | | > '../ticket/' || t.id as __grouplink__ |
23 | | > FROM attachment a |
24 | | > INNER JOIN ticket t |
25 | | > ON a.id == t.id |
26 | | > WHERE a.type=="ticket" |
27 | | > }}} |
| 3 | > [...] |