Results 1 to 3 of 3

Thread: merging rows

  1. #1
    Join Date
    Mar 2008
    Posts
    40

    Unanswered: merging rows

    Code:
    Subject       1             2             3
    ------------  ------------- ------------- ------------- 
    English       80            NULL          NULL
    English       NULL          NULL          95
    English       NULL          75            NULL
    First of all I do know that this should be handled at presentation layer but I'm forced to do it on SQL Select statement.

    I'm Trying to display it as following.

    Code:
    Subject       1             2             3
    ------------  ------------- ------------- -------------
    English       80            75            95
    Is it possible to do it?

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    select sybject, max(1), max(2), max(3)
    group by sybject

  3. #3
    Join Date
    Mar 2008
    Posts
    40
    Quote Originally Posted by pdreyer View Post
    select sybject, max(1), max(2), max(3)
    group by sybject
    Thanks. Worked

Posting Permissions

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