mysql> SELECT cast(SUBSTRING('123456789',1,4) as UNSIGNED) * 100; +----------------------------------------------------+ | cast(SUBSTRING('123456789',1,4) as UNSIGNED) * 100 | +----------------------------------------------------+ | 123400 | +----------------------------------------------------+ 1 row in set (0.00 sec)
select profit, deficit, concat(truncate((profit / deficit)*100,2),'%') as percentage from ((select count(*) as profit from angelfund where profit > 0) as profit, (select count(*) as deficit from angelfund where profit < 0) as deficit);
mysql> select 9 mod 5; +---------+ | 9 mod 5 | +---------+ | 4 | +---------+ 1 row in set (0.00 sec) mysql> select mod(5,2); +----------+ | mod(5,2) | +----------+ | 1 | +----------+ 1 row in set (0.00 sec) mysql> select mod(5,2);
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。