如果为空,如何使零 [英] How to make zero if null
本文介绍了如果为空,如何使零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果返回null,如何将其设为0?谢谢.
How do I make this a 0 if it returns null? Thanks.
sprintf(queryString, "SELECT (IPType) FROM tblURLIP WHERE IP = '%s'",ipSrc);
推荐答案
我会亲自使用三元声明:
Hi,
I would personally use a ternary statement:
sprintf(queryString, "SELECT (IPType) FROM tblURLIP WHERE IP = '%s'",NULL == ipSrc?"0":ipSrc);
最好的祝福,
-David Delaune
Best Wishes,
-David Delaune
我已经习惯了以下解决方案
I am used to the below solution
Select COALESCE(IPType,0) From WHERE IP = '%s'
这篇关于如果为空,如何使零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文