Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Colorado State University

    Unhappy Unanswered: Concatenate Multiple Rows?

    I can't figure out how to write an SQL query that concatenates one field from a list of records having other parameters in common. It is easier to show than explain. Take the data set:

    Spec T_R Section
    A008 23w 1
    A008 23w 2
    A008 23w 4

    I need a query that returns a single record/row like this:

    Spec T_R Section
    A008 23w 1, 2, 4

    Any help would be appreciated.

  2. #2
    Join Date
    Oct 2003

    This is common

    I've had this problem more times than I can count. While I was writing my SQL Tutorial, I ran across this function for MySQL :


    Which concatenates the grouped results into a string. If you are using Oracle, you'll need a stored procedure...


Posting Permissions

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