Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    30

    Unanswered: Rollup child rows?

    Is it possible to roll up all child records into one comma delimited field? For example, if the parent table is league info, and the child table is team info, I would be looking to return results like this:

    Field 1 Field 2
    NFL Bears, Browns, Saints, etc
    NBA Bulls, Celtics, Lakers, etc

    TIA,

    Rob

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Sep 2003
    Posts
    30
    1.
    Create Table League(ID Int, Name varchar(20))
    Create Table Team(ID INT, LeagueID INT, Name VarChar(20))
    2.
    INSERT INTO League Values(1, 'NFL')
    INSERT INTO Team Values(1, 1, 'Bears')
    INSERT INTO Team Values(2, 1, 'Browns')
    INSERT INTO Team Values(3, 1, 'Saints')
    3.
    Don't Know


    Better?

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    OK, you want to use the function found in here.

    http://weblogs.sqlteam.com/brettk/ar...1/05/3946.aspx

    You'll just need to join the 2 tables
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Sep 2003
    Posts
    30
    Talk about quick repsonses. Thanks!

Posting Permissions

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