Need help merging 4 rows into 1.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shortyzms
    New Member
    • Jan 2008
    • 4

    Need help merging 4 rows into 1.

    Hello Experts,

    Let's say I have 4 lines in a child table that point to a line in a parent table. Right now I'm INNER JOINing them on the parent table's primary key, and it's giving me 4 records that look like this...

    Key | child1val
    Key | child2val
    Key | child3val
    Key | child4val

    What I'd like to do is merge these all into 1 row that looks like this...

    Key | child1val | child2val | child3val | child4val

    Any suggestions?
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Hi shortyzms,

    Welcome to TSDN!!!

    Use GROUP_CONCAT().

    Comment

    Working...