Quote:
Originally Posted by chaley
BTW, the reason your SQL doesn't work is that some of the subqueries return multiple rows. You only see the first one. To see all of them you need to use group_concat(), like this:
Code:
SELECT
id,
author_sort,
title,
(SELECT name FROM publishers WHERE publishers.id IN (SELECT publisher from books_publishers_link WHERE book=books.id)) publisher,
(SELECT group_concat(format) FROM data WHERE data.book=books.id) formats,
path,
(SELECT group_concat(name) FROM tags WHERE tags.id IN (SELECT tag from books_tags_link WHERE book=books.id)) tags
FROM books
|
you are a genius (which you probably already knew)!

The query works perfectly

Thanks again for your help.