I have two tables:
ββββββββββββββββ¦ββββββββββββββ β Table: book β Column info β β βββββββββββββββ¬ββββββββββββββ£ β - id β int, pk β β - title (128)β varchar β ββββββββββββββββ©ββββββββββββββ ββββββββββββββββ¦ββββββββββββββ βTable: author β Column info β β βββββββββββββββ¬ββββββββββββββ£ β - id β int, pk β β - name (128) β varchar β β - bookId β int, fk β ββββββββββββββββ©ββββββββββββββ
(I really understand that this is not a completely normalized example, trying to keep it simple.)
The data collection from them is pretty straightforward:
SELECT b.title, a.name FROM book b INNER JOIN author a ON a.bookId = b.id WHERE b.id = x
However, this obviously gives one line per author - this is not what I want. Instead, I try to execute this data structure:
[String title, String [] authors (array)]
Is it possible to do this in one request? Preferably without βcombiningβ the authorβs columns into a single row. Something like an internal array in the column itself.
source share