wirte a query to remove null? following table are
col1 col2 col3
dinesh null null
null suresh null
null null prakesh
i want the output like
col1 col2 col3
dinesh suresh prkaesh
Answers were Sorted based on User's Feedback
Answer / kart
select max(col1) col1,max(col2) col2,max(col3) col3
from table;
col1 col2 col3
dinesh suresh prkaesh
Is This Answer Correct ? | 11 Yes | 4 No |
Answer / sivanagaraju
SELECT DISTINCT((SELECT COL1 FROM COLL WHERE COL1<>'NULL')),(SELECT COL2 FROM COLL WHERE COL2<>'NULL'),(SELECT COL3 FROM COLL WHERE COL3<>'NULL')
FROM COLL
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / sivanagaraju
SELECT C1.COL1,C2.COL2,C3.COL3
FROM COLL C1,(SELECT COL2 FROM COLL WHERE COL2 <>'NULL') C2,
(SELECT COL3 FROM COLL WHERE COL3<>'NULL') C3
WHERE C1.COL1<>'NULL';
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / sivanagaraju
SELECT C1.COL1,C2.COL2,C3.COL3
FROM (SELECT COL1 FROM COLL WHERE COL1 <>'NULL') C1,
(SELECT COL2 FROM COLL WHERE COL2 <>'NULL') C2,
(SELECT COL3 FROM COLL WHERE COL3<>'NULL') C3
WHERE C1.COL1 <>'NULL' AND C2.COL2<>'NULL';
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / apsar
select distinct((select col1 from z1 where no is not null))col1,(select col2 from z1 where sal is not null)col2,select col3 from z1 where col is not null) from z1
Hint:z1 is Table Name
Is This Answer Correct ? | 0 Yes | 1 No |
what are enums used for in mysql? : Sql dba
what is not null constraint? : Sql dba
what is datawarehouse? : Sql dba
In table three columns with 1 milion records(here there is no sequence values) i want add one more column with sequence values from the first how it is posible?
Does varchar need length?
How to get the procedure's, function's name from a package if it is wrapped(both spec & body).
Does a user_objects view have an entry for a trigger?
use of IN/ANY/ALL
How to write a procedure for displying the data in a TREE or (PARENT and CHILD ) relationship , for ex: A is the main project id, for this project B,C,D are sub tasks(sub project id's) for B the sub tasks are e,f,g and for c is h ,i ,j and for d is k,l,m now i need to display the o/p in a TREE fashion pls help me , thanks in advance surendra
How do I install sql?
What is the sql case statement?
what is the difference between join and union? : Sql dba