I've a Table
with 10 fields. Each field
or column
contains Integer
values.
Now I need only field(s) to be returned which has Null
or 0
in the result set.
You can use df. isnull(). sum() .
The IS NOT NULL condition is used to return the rows that contain non-NULL values in a column. The following query will retrieve the rows from the Person table which are MiddleName column value is not equal to NULL values.
NULL values represent missing unknown data. By default, a table column can hold NULL values.
This worked for me. For instance:
Instead of:
where column_name is null or column_name = 0
It would be:
where COALESCE(column_name,0) = 0
Posted by Jon Gabrielson on December 18, 2002
The function 'COALESCE' can simplify working with null values. for example, to treat null as zero, you can use: select COALESCE(colname,0) from table where COALESCE(colname,0) > 1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With