On 3 Oct 2017, at 11:13pm, Doug Nebeker <ad...@poweradmin.com> wrote:

> How can I select a document and get the complete sorted text back in a single 
> row (so I can do a JOIN on a different table with additional information)?  

There is a way which will probably work but the documentation adds a careful 
note that it will not always work.


So you would want something like

SELECT group_concat(LineText, '\n') FROM
        (SELECT LineText FROM DocLines
                WHERE DocID = 10
                ORDER BY LineIndex)

The problem is that the order of concatenation is arbitrary, in other words you 
shouldn’t rely on this working.

If you don’t want to use group_concat(), do it in your programming language.  

SELECT LineText FROM DocLines
                WHERE DocID = 10
                ORDER BY LineIndex

and concatenate the retrieved values in your programming language.

sqlite-users mailing list

Reply via email to