Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get distinct value with comma separated in SQL?

634151Jul 7 2009 — edited Jul 7 2009
Hi,

I have a query which will give the below output.

LINE_NUMBER MIN_1 MIN_2 MIN_3
1 200 300 400
2 200 300 400
3 200 300 400
4 100 200 400
5 300 600 700
6 100 200 400

In the above output, i have a line_number column will fetch the min_1, min_2, min_3 values. If you observe the output some of the line_number values contains the same row. For example line_number 1,2,3 are same and 4,6 are same and 5 is one row. I need the same in the output. I mean In my result i want to show the distinct of min_1, min_2, min3 values with comma spearated line_number like below. Can we achieve through SQL Queries or should we go for PL/SQL?

LINE_NUMBER MIN_1 MIN_2 MIN_3
1,2,3 200 300 400
4,6 100 200 400
5 300 600 700


Can anyone share with your thoughts?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2009
Added on Jul 7 2009
20 comments
5,809 views