how to eliminate records with null values in any of the cols



IBM's flagship relational database management system

how to eliminate records with null values in any of the cols

Postby dvramanad » Mon Sep 14, 2009 1:16 pm

Hi friends.My requirement is like this
I want to eliminate records which contain null in any of the coloumn or in all coloumns.

empno empname empaddress1 empaddress2 salary designation
------- ----------- -------------- --------------- ------- -------------
111 name1 usa 1000 se
222 name2 ind bangalore 2000 sse
333 name3 Canada 2200 tl
444 name4 1100 pm
555 name ind 1000 sse

when i query on the above table.I should get only the second record which contain values under all coloumns...
Pls help.
dvramanad
 
Posts: 6
Joined: Mon Sep 14, 2009 12:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to eliminate records with null values in any of the cols

Postby dick scherrer » Mon Sep 14, 2009 11:07 pm

Hello,

Suggest you become familiar/comfortable with the "Code" tag to improve readability and preserve alignment (Use Preview until you are satisfied with the appearance of the post, then Submit).

Are the columns defined to support NULL or are the values simply not entered?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: how to eliminate records with null values in any of the cols

Postby momi sabag » Mon Sep 21, 2009 11:23 am

try
select *
from mytable
where empno is not null
and empname is not null
and empaddress1 is not null
and empaddress2 is not null
and salary is not null
and designation is not null
momi sabag
 
Posts: 4
Joined: Mon Sep 21, 2009 11:11 am
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post