Results 1 to 3 of 3

Thread: If else?

  1. #1
    Join Date
    Jun 2006
    Posts
    22

    Question Unanswered: If else?

    I have a table with two count fields. One count is the estimated count and the other is the actual count that is populated later after certain processes run. I want to create a query that totals the actual count but if actual count is 0 I want to use the number in the estimated count field. Any help is appreciated.

  2. #2
    Join Date
    Jun 2006
    Posts
    22
    I got it. I used a case statement.

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You can also use "COALESCE(NULLIF(actual, 0), estimated)".
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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