|  |  | 
|  |  | Archives of the TeradataForumMessage Posted: Mon, 17 Oct 2005 @ 12:12:12 GMT
 
 Hi All, I have a requirement wherein I want to group records on Id column and then want to generate comma separated list of some other column pertaining to that id column. Here is an example to explain the requirement:- Have a table called customers with 2 columns "Id", "alternate Id". There is 1-M relationship between id and alternate Id's. Sample rows for the table 
     Id       Alternate Id
     ---------------------
      1       a1
      1       d3
      1       g5
      1       c6
      2       q3
      2       r4
      2       q1
      2       r6
      2       9h
      3       v6
      3       x4
      4       i4
      5       t6
      6       x5
      6       k9
The out should look like this 
     Id      Comma separated list of alternate Id's
     ----------------------------------------------
      1      a1,d3,g5,c6
      2      q3,r4,q1,r6,9h
      3      v6,x4
      4      i4
      5      t6
      6      x5,k9
Could someone suggest efficient way of writing the query or above reuirement. Thanks in advance, Regards, Rachana 
 | ||||||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||