Results 1 to 4 of 4

Thread: concatenation problem

  1. #1
    Join Date
    Dec 2007
    Posts
    13

    concatenation problem

    i am having data something like this:
    number starting point ending point
    1 ABC DEF
    2 DEF ABC
    1 PQR STU
    2 STU PQR
    1 ABC DEF
    2 DEF PQR
    3 PQR ABC

    and i want it to be like this in my new table based on number column:
    CONCATENATED
    ABC/DEF/ABC
    PQR/STU/PQR
    ABC/DEF/PQR/ABC

    can anyone suggest me how to write a query for this one?

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You need to write a procedure to loop through the rows. The number of rows you need to concatenate is not same, so it may not be possible to write it in a query.

  3. #3
    Join Date
    Dec 2007
    Posts
    13
    thnx for ur response................

  4. #4
    Join Date
    Dec 2004
    Posts
    502
    I think you need another column in this query. How do you know that the first "1 ABC DEF" record is to be concatenated with the "2 DEF ABC" record instead of the "2 DEF PQR" record? If these are supposed to be processed in some sort of order, there has to be another column used to do this ordering for a loop to work. Or, there needs to be another column used to group like records together.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •