Remving duplicate rows and NULLS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rai28pankaj@gmail.com

    Remving duplicate rows and NULLS

    Hi,

    I have unoin of 2 queries which gives outpur as:


    Service_Name P3 P4
    -------------------------------------
    S1 1 NULL
    S2 4 NULL
    S3 3 NULL
    S1 NULL 5
    S2 NULL 2
    S3 NULL 6

    I want 1 row for each Service with values in both columns like:

    Service_Name P3 P4
    -------------------------------------
    S1 1 5
    S2 4 2
    S3 3 6

    Can anybody please help me out?

    Thanks in advance for the help

    Cheers
    Panky

  • markc600@hotmail.com

    #2
    Re: Remving duplicate rows and NULLS

    select Service_Name,
    max(P3) as P3,
    max(P4) as P4
    from mytable
    group by Service_Name

    Comment

    Working...