我有一塊正在打擊一些空記錄的MySQL,如何將它設置爲返回0如果爲NULL? 謝謝!如果爲NULL,則返回零
嘗試這樣:
sprintf(queryString, "SELECT COUNT(*) FROM tblURLIP
WHERE IP = '%s' AND IPStatus = '1' AND IPMax = '0'
AND IPType ='3'", ipSrc);
沒有工作:
sprintf(queryString, "SELECT COUNT(*) FROM tblURLIP
WHERE IP = '%s' AND IPStatus = '1' AND IPMax = '0'
AND IPType ='3'", ipSrc,NULL),0);
'COUNT(*)'應該返回0如果沒有匹配的行。你從哪裏得到'NULL'? –
因爲我在lsniff.exe的0x57088ce4處得到未處理的異常:0xC0000005:訪問衝突讀取位置0x00000000。 –