Subject | How To Concatinate Multiple Rows Data Into Single One |
---|---|
Author | Vishal Tiwari |
Post date | 2010-09-01T08:04:55Z |
Hi All,
I have one requirement, but before that let me explain the table structure:
I have a table say for example Books and it contains the books list as:
Table Name = Books
Book_Name
Book_A
Book_B
Book_C
I have another table Called Reader_Books, this would contain the no. of user taken those books for reading, table structure is as follows:
Table Name : Reader_Books
Reader_Code Book_Name
R001 Book_A
R001 Book_B
R002 Book_A
R002 Book_B
R002 Book_C
R003 Book_A
I need the data in following manner:
Reader_Code Book_Name
R001 Book_A
R002 Book_A, Book_B, Book_C
R003 Book_A
I tried my efforts but no result, but still I would like to learn how to achieve this.
I need to achieve above result only using SQL.
Thanks In Advance.
With Best Regards.
Vishal
[Non-text portions of this message have been removed]
I have one requirement, but before that let me explain the table structure:
I have a table say for example Books and it contains the books list as:
Table Name = Books
Book_Name
Book_A
Book_B
Book_C
I have another table Called Reader_Books, this would contain the no. of user taken those books for reading, table structure is as follows:
Table Name : Reader_Books
Reader_Code Book_Name
R001 Book_A
R001 Book_B
R002 Book_A
R002 Book_B
R002 Book_C
R003 Book_A
I need the data in following manner:
Reader_Code Book_Name
R001 Book_A
R002 Book_A, Book_B, Book_C
R003 Book_A
I tried my efforts but no result, but still I would like to learn how to achieve this.
I need to achieve above result only using SQL.
Thanks In Advance.
With Best Regards.
Vishal
[Non-text portions of this message have been removed]