两列的SQL合并结果

时间:2015-12-08 11:40:45

标签: sql

我有一张像这样的桌子 -

firstName - lastName - dob - region - authority

这是使用

的查询
 SELECT firstName, lastName, region from whatever

是否可以在结果中合并firsName和lastName,我需要在实际数据库中保持firstName和lastName分开但是在结果中合并它们 -

firstname lastname - region

3 个答案:

答案 0 :(得分:0)

试试..

SELECT CONCAT(firstName,' ',lastName) as Name, region from whatever

答案 1 :(得分:0)

您的查询将如下:

<强>甲骨文:

SELECT firstname || ' ' || lastname as name, region from whatever

<强> MySQL的:

SELECT CONCAT(firstname ,' ', lastname) as name, region from whatever

<强> MSSQL:

SELECT firstname + ' ' + lastname as name , region from whatever

答案 2 :(得分:0)

我愿意:

 SELECT firstName || ' ' || lastName as name, region from whatever;