如何获取 PostgreSQL 中的所有列以及连接两列?

发布于 2025-01-14 17:49:17 字数 286 浏览 3 评论 0原文

所以我加入这两个表A和B B 包含名字和姓氏 所以我正在编写这样的查询

select col1,col2,...,col12,CONCAT(first_name,last_name) as NAME 
from A 
  INNER JOIN B on A.email=B.email;

现在我想要此查询中的所有列,但不是编写所有列名称...有什么方法可以获取每一列以及这两个 first_name的串联>姓氏

So i am joining these two tables A and B
B contains first_name and last_name
So i am writing query like this

select col1,col2,...,col12,CONCAT(first_name,last_name) as NAME 
from A 
  INNER JOIN B on A.email=B.email;

Now i want all columns from this query but instead of writing all column names...are there any ways to get every column along with concatenation of these two first_name and last_name?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红尘作伴 2025-01-21 17:49:17

使用*

select *, CONCAT(first_name,last_name) as NAME 
from A 
  INNER JOIN B on A.email=B.email;

如果只想获取一次连接列,可以使用:

select *, CONCAT(first_name,last_name) as NAME 
from A 
  INNER JOIN B using (email);

Use *

select *, CONCAT(first_name,last_name) as NAME 
from A 
  INNER JOIN B on A.email=B.email;

If you want to get the join column only once, you can use:

select *, CONCAT(first_name,last_name) as NAME 
from A 
  INNER JOIN B using (email);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文