[英]Joining contents of 2 columns
How do I join the content of two columns for the resulting column below: 如何为下面的结果列连接两列的内容:
Group: Family:
polychaete spionidae
gastropod rossoidae
foraminifera rotaliidae
polychaete magelonidae
result needed: 需要的结果:
Taxa:
polychaete_spionidae
gastropod_rossoidae
foraminifera_rotaliidae
polychaete_magelonidae
In ANSI SQL, we can use the concatenation operator ||
在ANSI SQL中,我们可以使用串联运算符
||
: :
SELECT "Group" || '_' || Family AS Taxa
FROM yourTable;
This would vary depending on the database. 具体取决于数据库。 For instance, SQL Server uses
+
as the concatenation operator. 例如,SQL Server使用
+
作为串联运算符。 Some databases have formal concatenation functions. 一些数据库具有正式的串联功能。
By the way, you should avoid naming your columns using SQL keywords like Group
. 顺便说一句,您应该避免使用诸如
Group
类的SQL关键字来命名列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.