SQL code: select count(id) t_count from cet6 where word='a'; if t_count> 0 then update set cet68=2,total=total+2 where word='a'; else insert into cet6(word,total,cet68) values('a',2,2); end;
1064´íÎó µ«ÊÇÎÒûÓÐʹÓõ½¹Ø¼ü×Ö SQL code: select count(id) t_count from cet6 where word='a'; if t_count> 0 then update cet6 set cet68=2,total=total+2 where word='a'; else insert into cet6(word,total,cet68) values('a',2,2); end;
Ö§³Ö¡£
´æ´¢¹ý³ÌµÄÏà¹ØÖªÊ¶µãÇë²Î¿¼¹Ù·½Îĵµ£º
http://dev.mysql.com/doc/refman/5.1/zh/stored-procedures.html MySQL ÓëÆäËüÊý¾Ý¿â²»Ò»Ñù£¬²»ÏòORALCE £¬ SQL SERVERÖÐÖ§³ÖÄäÃû¿é¡£Õâ¸öIF THENÓï¾äÖ»ÄÜÓõ½´æ´¢¹ý³Ì»òÕß´¥·¢Æ÷ÖС£