Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Unanswered: Two questions on combining multiple rows for output and id's

    Hi,

    I have 2 questions about Microsoft SQL Server.

    Firstly, say i have a row like this from multiple tables joined up:

    ID--day--week--roomID
    1--5--1--55
    1--5--3--55
    1--5--5--55
    1--5--7--55
    1--5--9--55

    Is there an easy way to make this:

    1--5--1,3,5,7,9--55

    and combine the rows?

    Secondly,

    Say I have a room table with room id and room name. Although the room id is stored in the database for a request, how would i output the actual room name instead of the ID?

    Thanks for your time

  2. #2
    Join Date
    Aug 2008
    Posts
    2
    Just realised how to do the second question I posted by joins (forgot how to do it!).

    Still confused about the other problem though!

  3. #3
    Join Date
    Mar 2009
    Location
    Australia
    Posts
    113
    I would write a UDF that takes ID, day, roomID as input and returns a comma separated string.

Posting Permissions

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