select - Adding Columns in SQL -
i have equation in select query
monitoring fees"+"ccn fees"+"wkrpt fees"+"monrpt fees"+"client dashboard fees"+"take command servers fees"+"patch management servers fees"+"remote background servers fees" "total capped server fees"
a problem seeing add together if there value in each of columns need add together if there no data.
for remote background server, fees not kick in until september of 2013. total capped server fees equation isn't adding add together others until there values starting in september 2013 instead of years.
some of columns returning null
. need utilize isnull
homecoming 0 instead of null
. example:
isnull("monitoring fees", 0) + isnull("ccn fees", 0) + isnull("wkrpt fees", 0) + isnull("monrpt fees", 0) + isnull("client dashboard fees", 0) + isnull("take command servers fees", 0) + isnull("patch management servers fees", 0) + isnull("remote background servers fees", 0) "total capped server fees"
i assuming using sql server.
if using mysql equivalent function ifnull
. example:
ifnull("monitoring fees", 0) + ifnull("ccn fees", 0) + ifnull("wkrpt fees", 0) + ifnull("monrpt fees", 0) + ifnull("client dashboard fees", 0) + ifnull("take command servers fees", 0) + ifnull("patch management servers fees", 0) + ifnull("remote background servers fees", 0) "total capped server fees"
sql select arithmetic-expressions
No comments:
Post a Comment