Bug #52435 | GROUP_CONCAT fails to return row when value NULL | ||
---|---|---|---|
Submitted: | 29 Mar 2010 11:46 | Modified: | 30 Mar 2010 10:03 |
Reporter: | Hameer Abbasi | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S1 (Critical) |
Version: | 5.1.44-community | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | group_concat, missing rows |
[29 Mar 2010 11:46]
Hameer Abbasi
[29 Mar 2010 11:50]
Hameer Abbasi
Oh, and yes, the rows ARE returned if there is an author assigned to the book.
[29 Mar 2010 12:06]
Peter Laursen
Wasn't it more appropriate to use the CONCAT_WS() function here?. GROUP_CONCAT() with no GROUP BY does not make sense to me. GROUP_CONCAT() is an aggregate function, refer http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat and http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws Peter (not a MySQL person).
[29 Mar 2010 12:21]
Hameer Abbasi
I'm sorry, i have another view that causes the bug, thanks peter for the tip. Here's the code: SELECT Books.bookID AS bookID, Books.title AS title, Books.subtitle AS subtitle, GROUP_CONCAT_SPECIAL(Books.bookID) AS authors, Publishers.name AS publisher, Categories.name AS category, Books.edition AS edition, Books.volume AS volume, Books.pyear AS pyear, Books.isbn10 AS isbn10, Books.isbn13 AS isbn13, Books.price AS price FROM Books, Authors, BooksAuthors, Publishers, Categories WHERE Books.bookID = BooksAuthors.bookID AND Authors.authorID = BooksAuthors.authorID AND Books.publisherID = Publishers.publisherID AND Books.categoryID = Categories.CategoryID GROUP BY Books.bookID;
[30 Mar 2010 8:14]
Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php You are using INNER JOIN which requires corresponding row is in each table. Read at http://dev.mysql.com/doc/refman/5.1/en/join.html about JOIN syntax.
[30 Mar 2010 10:03]
Hameer Abbasi
The can someone help me with creating an OUTER JOIN with more than two tables? An example would suffice.