Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 在SQL中向数字添加百分比_Mysql_Sql_Amazon Redshift - Fatal编程技术网

Mysql 在SQL中向数字添加百分比

Mysql 在SQL中向数字添加百分比,mysql,sql,amazon-redshift,Mysql,Sql,Amazon Redshift,我想在SQL中的数字后面添加一个百分号 这就是我的疑问 select cast(vetted as float)/cast(account_create as float)*100 from numbers 我已尝试使用format函数将整数更改为字符串并连接百分号,但这似乎不起作用您可以使用以下解决方案: 您可以尝试以下操作: select CONCAT(cast(vetted as float)/cast(account_create as float)*100,'%') from num

我想在SQL中的数字后面添加一个百分号

这就是我的疑问

select cast(vetted as float)/cast(account_create as float)*100 from numbers

我已尝试使用format函数将整数更改为字符串并连接百分号,但这似乎不起作用

您可以使用以下解决方案:


您可以尝试以下操作:

select CONCAT(cast(vetted as float)/cast(account_create as float)*100,'%') from numbers

您还可以使用函数concat_ws在concat of number和delimeter number之间放置分隔符

您使用的是MySQL还是红移?他们完全不同。
select CONCAT(cast(vetted as float)/cast(account_create as float)*100,'%') from numbers