access
SELECT ExportID,BookID, ExportCode, ProductCode, Unit, AuthorizeExportCount, HasExportCount,V_HandBook_UseCircsStat.ExportTotalCount, V_HandBook_UseCircsStat.ExportTotalPrice, T_HandBook_Exports.AuthorizeExportCount-IIf(V_HandBook_UseCircsStat.ExportTotalCount Is Null,0,V_HandBook_UseCircsStat.ExportTotalCount) AS LeavedCount
FROM T_HandBook_Exports LEFT JOIN V_HandBook_UseCircsStat ON T_HandBook_Exports.ExportID=V_HandBook_UseCircsStat.ExportID);
access 判断数据是否为空情况
IIf(判断条件是否成立,成立,不成立) 如果条件成立则选择成立的数据,不成立则选择后面的数据.
sql
SELECT ExportID,BookID, ExportCode, ProductCode, Unit, AuthorizeExportCount, HasExportCount,V_HandBook_UseCircsStat.ExportTotalCount, V_HandBook_UseCircsStat.ExportTotalPrice, T_HandBook_Exports.AuthorizeExportCount-(case when V_HandBook_UseCircsStat.ExportTotalCount Is Null then 0 else V_HandBook_UseCircsStat.ExportTotalCount end) AS LeavedCount
FROM T_HandBook_Exports LEFT JOIN V_HandBook_UseCircsStat ON T_HandBook_Exports.ExportID=V_HandBook_UseCircsStat.ExportID);
两者语法判断区别