Im trying this simple query, where if a book has the same ID but different names it should be shown in one row and not two...Now it is showing - 1 AuthorDude - 1 AuthorGirl - 2 AuthorblablaWhile it should show - 1 AuthorDude, AuthorGirl - 2 Authorblabla SELECT a.book_id, b.Name from BOOK_SALES a left outer join ( select Book_id,is_primary, STUFF((select ', ' + Name from BOOK_CONTRIBUTOR B where B.BOOK_ID = A.BOOK_ID for xml path('')),1,1,'') Name from BOOK_CONTRIBUTOR A group by Book_id,IS_PRIMARY ) b on a.BOOK_ID = b.BOOK_ID
When i do a inner join, it would just show many Book_ID`s, but with the authors combined.http://mnmt.no