在 App\Console\Commands下 添加以下内容的KeyGenerateCommand.php文件 <?php namespace App\Console\Commands; use Illuminate\Console\Command; class KeyGenerateCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected…
select num ,cast(round(convert(float,isnull((a.Sum_Num-d.Sum_Num),0))/convert(float,c.Sum_Store_Num)*100,1) as varchar(50))+'%' as 報告 from FORM 做除法运算,分母不为0,round函数保留一位小数.cast函数强制类型转换,转成字符串类型,然后与'%'进行字符串拼接. sql中换行符的使用: SQL本身并不使用换行符,因为换行符就跟空格符和回车符一样都…