简体   繁体   English

select 单列中的多列,postgresql 中有空格

[英]select multiple columns in a single column with space in postgresql

I have three columns called first name, last name, middle name I want to combine all these and add in another table with column name full name我有三列,分别称为名字、姓氏、中间名,我想将所有这些结合起来,并在另一个表中添加列名全名

ex- first name = Ram last name = Kumar前名字 = Ram 姓氏 = Kumar

select first name ||middle name || select 名 || 中间名 || last name,* from users I am getting Ramkumar how can I add space between these columns so that I can get output Ram Kumar姓,* 来自用户我正在获取 Ramkumar 如何在这些列之间添加空格以便我可以获得 output Ram Kumar

Just add the space into the concatenation:只需将空格添加到串联中:

SELECT 
    first_name || ' ' || middle_name || ' ' || last_name,
    * 
FROM users

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM