Results 1 to 2 of 2

Thread: Assign 0 for null value

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Assign 0 for null value

    Hi I have an query and i want to assign 0 for null or empty values
    i add tow pictrs first one for the query second one for the result. and i point wher i want the result should be zero
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Posts
    4
    Try the IFNULL function.

    SELECT IFNULL(SUM(YourColumn),0);

    IFNULL(expr1,expr2)
    If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used.

Posting Permissions

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