如何使用字段长度进行选择/使用 select 取消修剪
我有这个表,我想从中选择值。问题是我想在我的选择的输出中获得准确的长度,就像我在表中一样。 例如:
CREATE TABLE myschema.test_table
(
id serial NOT NULL,
otyp CHARACTER VARYING(3),
fname CHARACTER VARYING(8),
age integer
) WITH(OIDS=FALSE);
假设这个表包含
id | otyp | fname | age
----+------+--------+-----
1 | aa | gustav | 20
(1 row)
SELECT id || otyp || fname || age FROM myschema.test_table;
这会给我这个结果:
1aagustav20
I want the output to be
1aa gustav 20
任何帮助将不胜感激!
I have this table that I would like to select values from. The thing is that I would like to get the exact amount of length in the output of my select as I have in my table.
For example:
CREATE TABLE myschema.test_table
(
id serial NOT NULL,
otyp CHARACTER VARYING(3),
fname CHARACTER VARYING(8),
age integer
) WITH(OIDS=FALSE);
And let's say that this table contain
id | otyp | fname | age
----+------+--------+-----
1 | aa | gustav | 20
(1 row)
SELECT id || otyp || fname || age FROM myschema.test_table;
This would give me this result:
1aagustav20
I want the output to be
1aa gustav 20
Any help would appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要做
Just do
我解决了问题!
I solved the problem!