If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > how to eliminate null value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-05-04, 08:44
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
how to eliminate null value

Hi,

Here is my query and it's result.

db2 => SELECT CHAN_NAME, COUNT(LOGON_ID) FROM DB2A.HDRLOG LOG, DB2A.CHANNEL CHN WHERE LOG.TSTAMP BETWEEN '2004-03-25-00.00.00' AND '2004-04-03-23.59.59' AND LOG.CHANNELID = CHN.CHANNELID GROUP BY CHAN_NAME

CHAN_NAME 2
----------- -----------
46093
BA 29860
CC 18
OLB 9450
WAS 37


what do i need to do if I want result as given below.
Basically i want eliminate the row which has CHANNELNAME is null
CHAN_NAME 2
----------- -----------
BA 29860
CC 18
OLB 9450
WAS 37

I appreciate ur help!

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-05-04, 08:53
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Try:

SELECT CHAN_NAME, COUNT(LOGON_ID) FROM DB2A.HDRLOG LOG, DB2A.CHANNEL CHN WHERE LOG.TSTAMP BETWEEN '2004-03-25-00.00.00' AND '2004-04-03-23.59.59' AND LOG.CHANNELID = CHN.CHANNELID and channelname is not null
GROUP BY CHAN_NAME


Andy
Reply With Quote
  #3 (permalink)  
Old 04-05-04, 08:55
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Re: how to eliminate null value

Hi

Try this:

SELECT CHAN_NAME, COUNT(LOGON_ID) FROM DB2A.HDRLOG LOG, DB2A.CHANNEL CHN WHERE LOG.TSTAMP BETWEEN '2004-03-25-00.00.00' AND '2004-04-03-23.59.59' AND LOG.CHANNELID = CHN.CHANNELID AND LOG.CHAN_NAME IS NOT NULL GROUP BY CHAN_NAME

BOW
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #4 (permalink)  
Old 04-05-04, 09:03
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
Hi,

it did not work in my case. I guess CHANNELNAME is not null . I guess it could have blank space. If that is the case what i suppose to do?
Reply With Quote
  #5 (permalink)  
Old 04-05-04, 09:12
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You could try:

rtrim(channelname) <> ''

Andy
Reply With Quote
  #6 (permalink)  
Old 04-05-04, 09:20
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
Thumbs up

yes Andy it worked

thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On