none
Merge Multiple row in one row (Self Join)

    Question

  • Hi , I have a data table like below :-

    C1        C2                  C3                 C4       C5               C6

    FL   All Other Audis    0                    012     16/5/2009     LT
    FL   All Other Audis    0                    030     16/5/2009     LT
    FL   All Other Audis    UnLimited        0        16/5/2009     RD
    FL   NOT ELIGIBLE      0                   12       12/3/2011     LT
    FL   NOT ELIGIBLE      UnLimited       0        12/3/2011     RD

    I want to see the data like below :-

    C1       C2                    C3                C4          C5     

    FL   All Other Audis     UnLimited        012     16/5/2009    
    FL   All Other Audis     UnLimited        030     16/5/2009    
    FL   NOT ELIGIBLE      UnLimited        12       12/3/2011    

    Could you please let me know your opinion how to achieve this ?

    Thanks

    BKK


    • Edited by Kiroriwal Friday, January 17, 2014 9:50 PM
    Friday, January 17, 2014 9:49 PM

Answers

  • Select C1,C2, C3,C4,C5 FROM 
    (SELECT C1,C2,Max(C3) Over() as C3,C4,C5 FROM yourtable) t
    WHERE C4<>'0'


    • Marked as answer by Kiroriwal Friday, January 17, 2014 10:35 PM
    Friday, January 17, 2014 10:12 PM

All replies