Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    54

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  3. #3
    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

  4. #4
    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?

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You could try:

    rtrim(channelname) <> ''

    Andy

  6. #6
    Join Date
    Mar 2004
    Posts
    54

    Thumbs up

    yes Andy it worked

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •