首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

运用 IFNULL 或 COALESCE

2013-03-14 
使用 IFNULL 或 COALESCESELECT IFNULL(SUM(Column1), 0) AS total FROM...SELECT COALESCE(SUM(Column1),

使用 IFNULL 或 COALESCE
SELECT IFNULL(SUM(Column1), 0) AS total FROM...SELECT COALESCE(SUM(Column1), 0) AS total FROM...

?The difference between them is that IFNULL is a MySQL extension that takes two arguments, and COALESCE is a standard SQL function that can take one or more arguments. When you only have two arguments using IFNULL is slightly faster, though here the difference is insignificant since it is only called once.

热点排行