SQLite Forum

SELECT question
If you were using the linkages such that docs:keywords and docs:authors are both N:M you could use a query like the following to get one row per docs instance:

  select docs.docid,
          select group_concat(name, '; ')
            from (
                    select name
                      from docauthors, authors
                     where docauthors.docid == docs.docid
                       and docauthors.authorid == authors.authorid
                  order by name
         ) as authors,
          select group_concat(keyword, '; ')
            from (
                    select keyword
                      from dockeywords, keywords
                     where dockeywords.docid == docs.docid
                       and dockeywords.keywordid == keywords.keywordid
                  order by keyword
         ) as keywords
    from docs
order by docid desc
   limit 5

with all the applicable authors and keywords as single semi-colon separated lists ...