Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.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
Sql 在'中打印整数金额*';_Sql_Postgresql - Fatal编程技术网

Sql 在'中打印整数金额*';

Sql 在'中打印整数金额*';,sql,postgresql,Sql,Postgresql,我的桌子是: ID | Name | Stars 1 | Harry | 2 2 | Peter | 5 ID |名称|星星 1 |哈里| 2 2 |彼得| 5 我想创建一个查询,该查询提供以下输出: ID | Name | Stars 1 | Harry | ** 2 | Peter | ***** ID |名称|星星 1 |哈里|** 2 |彼得|***** 我的查询应该是什么样子?我考虑过一个循环,但这在postgresql中是不可能的 试试这个: select id, na

我的桌子是:

ID | Name | Stars 1 | Harry | 2 2 | Peter | 5 ID |名称|星星 1 |哈里| 2 2 |彼得| 5 我想创建一个查询,该查询提供以下输出:

ID | Name | Stars 1 | Harry | ** 2 | Peter | ***** ID |名称|星星 1 |哈里|** 2 |彼得|***** 我的查询应该是什么样子?我考虑过一个循环,但这在postgresql中是不可能的

试试这个:

select 
id,
name,
repeat('*', stars)
from table

也许,如果支持,
repeat(“*”,stars)
。这对我很有用!即使您不知道
repeat()
函数,也可以使用
left(“**********”,stars)