By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,099 Members | 771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,099 IT Pros & Developers. It's quick & easy.

concatenate values from different rows

P: 9
Hi Experts.

Need a help in writing a query. Here is the scenario.

table has three columns : Emp Id, Book Name, Book Number

sample data is......
1 ten 1
1 two 2
1 Thr 3
2 Tss 1
2 ans 2

Query output should be like this
1 ten two thr
2 Tss ans -
in the order of Emp Id, Book name1, book name2, book name3.

regards.
Vinay
Mar 2 '07 #1
Share this Question
Share on Google+
2 Replies

ronverdonk
Expert 2.5K+
P: 4,258
Could lead to an indefinite number of joins. It would be a lot easier to handle this with the programming language that you use.

Ronald :cool:
Mar 5 '07 #2

P: 39
hi...

Try with the following query....

Example:

select id,group_concat(book name) from tbl group by id;


Regards,
S.Ashokkumar
DB Programmer
Mar 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.