oracle sql how to distinct and remove all null values in the fields -


hi how distinct , remove null values in fields. original table. im using sqldeveloper , oracle.

empno      lastname             firstname            05-may-15                   06-may-15                   07-may-15                   08-may-15                   09-may-15                  ---------- -------------------- -------------------- --------------------------- --------------------------- --------------------------- --------------------------- --------------------------- 00000113   reyesue              marie                +000000000 08:04:00.000000                                                                                                                   00000113   reyesue              marie                                            +000000000 08:12:00.000000                                                                                       00000113   reyesue              marie                                                                        +000000000 08:04:00.000000                                                           00000113   reyesue              marie                                                                                                    +000000000 08:06:00.000000                               00000113   reyesue              marie                                                                                                                                +000000000 08:25:00.000000   00000114   santosy              michaela             +000000000 08:03:00.000000                                                                                                                   00000114   santosy              michaela                                         +000000000 08:04:00.000000                                                                                       00000114   santosy              michaela                                                                     +000000000 08:08:00.000000                                                           00000114   santosy              michaela                                                                                                 +000000000 08:05:00.000000                               00000114   santosy              michaela                                                                                                                             +000000000 08:09:00.000000   

and output wanted

empno      lastname             firstname            05-may-15                   06-may-15                   07-may-15                   08-may-15                   09-may-15                  ---------- -------------------- -------------------- --------------------------- --------------------------- --------------------------- --------------------------- --------------------------- 00000113   reyesue              marie                +000000000 08:04:00.000000  +000000000 08:12:00.000000  +000000000 08:04:00.000000  +000000000 08:06:00.000000 +000000000 08:25:00.000000 00000114   santosy              michaela             +000000000 08:03:00.000000  +000000000 08:04:00.000000  +000000000 08:08:00.000000  +000000000 08:05:00.000000 +000000000 08:09:00.000000 

you can use aggregate functions, min, example:

select "empno"      , "lastname"      , "firstname"      , min("05-may-15") "05-may-15"      , min("06-may-15") "06-may-15"      , min("07-may-15") "07-may-15"      , min("08-may-15") "08-may-15"      , min("09-may-15") "09-may-15" tbl group "empno"        , "lastname"        , "firstname"                

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -