Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Gees
Starting Member
1 Post |
Posted - 2005-11-16 : 04:47:02
|
| I have the following situation: I Have 2 (or more) tables. Not exactly my situation, but to keep it simple:One table with books, and one table with authors. Each author has written one or more books, so with an inner join my query return several books per author.Now, I want to use a datagrid in ASP.NET to display the results. But I don't want more then one row listed per author. The books that author has written should be displayed as a comma seperated string in a column at the same row. And I want SQL server to perform that magic for me (I could do it in ASP.NET).So I don't know the best approach for this situation. Is it possible to write a query that does all this instantly for me? Or should I write a function or stored procedure that loops through related books and returns them all in a string per author row? And I want the best performance solution, ofcourseBtw, as you can see I consider myself still at beginner level. So some code examples are appriciated. I wrote some triggers etcetera, but the code I write for them is more in the category luck then wisom.Thank you in advance... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|