Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009
    Posts
    4

    Unanswered: Multiple Rows into One Row w/ Multiple Columns

    Hello All,
    I have a table with 4 columns (RowID, TimeID, TimeData, RecordTime)
    There are several records, each containing a different int value for TimeData but several rows may share the same TimeID.
    For Example:
    1 1 565 May 1...
    2 1 600 May 1...
    3 1 463 May 1...
    4 2 938 May 1...
    5 2 233 May 1...

    Is it possible to return this data from a stored procedure in the form of one row for each TimeID?
    Example:
    1 565 600 463 May 1...
    2 938 233 NULL May 1...

    There may not always be the same number or rows for each TimeID.

    From this query I will create a recordset and populate an Excel Spreadsheet.

    Thanks for any help or advice in advance. I am definitely a novice when it comes to SQL.

  2. #2
    Join Date
    Dec 2008
    Posts
    135
    try this by pivot or dynamic cross tab
    see this link too
    Dynamic Crosstab with multiple PIVOT Columns - Madhivanan

Posting Permissions

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