MySQL/MSSQL has a neat little inline if function you can use within queries to detect null values, as shown below.
SELECT ... foo.a_field AS \"a_field\", SELEC
You want the nvl function: nvl(foo.bar, 0)
Oracle does support various ifs and cases as well.