null¤Ê¤Î¤Ë¡¢0¤òÊÖ¤·¤Æ¤¤¤¿¤È¤¤¤¦¤Î¤¬»ö¼Â¤Ê¤é¡¢MySQL 3.23.55¤ËÌäÂ꤬
¤¢¤Ã¤¿¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡©
 
null¤Î¾ì¹ç¤Ë¡¢0¤È¤·¤¿¤¤¤Ê¤é¡¢coalesce´Ø¿ô¤ò»È¤¦¤Î¤¬´Êñ¤À¤È»×¤¤¤Þ¤¹¡£
 
select sum(coalesce(id,0)) from tbl1;
 
 
¤Ê¤ª¡¢coalesce´Ø¿ô¤Ï¡¢¼çÍפÊRDBMS¤Ç¡¢Æ±¤¸µ¡Ç½¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

> Date: Tue, 20 Jan 2009 10:17:07 +0900
> From: akiro@sibagaki.com
> Subject: [mysql 14716] sum´Ø¿ô¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤ëÆ°ºî¤Î°ã¤¤
> To: ml@mysql.gr.jp
>
> ¡¡¤¤¤Ä¤â¤ªÀ¤ÏäˤʤäƤ¤¤Þ¤¹¡£
> ¡¡mysql¤ò3.23¤«¤é5.0¤Ë¹¹¿·¤·¤¿¤È¤­¤Ë¡¢°Ê²¼¤Î¥È¥é¥Ö¥ë¤Ë
> ¸«Éñ¤ï¤ì¤Þ¤·¤¿¡£
>
> create table tbl1(id int);
> insert into tbl1 values(null);
>
> ¤È¤·¤Æ¤ª¤¤¤Æ¡¢sum¤ò¼è¤ë¤È¡¢
> select sum(id) from tbl1;
>
> 3.23.55¤Ç¤Ï0¤¬ÊÖ¤µ¤ì¡¢5.0.45¤Ç¤Ïnull¤¬ÊÖ¤µ¤ì¤Þ¤¹¡£
>
> ¤³¤ì¤Ï¼þÃΤΤ³¤È¤Ê¤Î¤«¤É¤¦¤«¡¢
> ¤Ê¤Ë¤«Ê̤ΰ㤤¤«¤éͳÍ褹¤ë¤â¤Î¤Ê¤Î¤«¤É¤¦¤«¡¢
> ¤Þ¤¿¡¢null¤ò·×»»¤«¤é½ü³°(0¤È¤·¤Æ·×»»)¤¹¤ë¤Î¤Ë
> ´Êñ¤Ê¤¤¤¤ÊýË¡¤¬¤¢¤ë¤Î¤«¤É¤¦¤«¡¢
>
> ¶µ¤¨¤Æ¤¤¤¿¤À¤±¤ì¤Ð½õ¤«¤ê¤Þ ¹¡¨Â¼ÂÒ¾¦çô» ¼ÂÒ¾¦çô» ߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯߯¼ÂÒ¾¦çô» ¼ÂÒ¾¦çô» ¼Æ³À¡¡ akiro@sibagaki.com
>
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>
>
>



¡Ú¸öÅÄÐÔ̤Æý¸¡Û¿·¶Ê¤«¤é¥é¥¤¥Ö±ÇÁü¡¢ÆÈÀꥤ¥ó¥¿¥Ó¥å¡¼¤Ê¤É¸öÅÄÐÔ̤ËþºÜ EXILE¤â¸öÅÄÐÔ̤¤â²¿Å٤Ǥâʹ¤±¤ë¡ª