[英]How to combined first_name and last_name using sql query?
There are two columns in database as name FIRST_NAME and LAST_NAME.i want to join both the name and display in single column. 数据库中有两列,分别是名称FIRST_NAME和LAST_NAME。我想同时加入该名称并在单列中显示。 The query which is used by me is given below but it gives error as Incorrect syntax near 'NAME'. 下面提供了我使用的查询,但由于“ NAME”附近的语法不正确,因此出现错误。
Modify the query: 修改查询:
SELECT [CREATED_ON], MUD.PK_ID AS USER_ID,
(MUD.FIRST_NAME + ' ' + MUD.LAST_NAME NAME)
AS NAME FROM USER_TABLE
Remove the erroneous 'NAME'. 删除错误的“ NAME”。 eg 例如
SELECT [CREATED_ON], MUD.PK_ID AS USER_ID, (MUD.FIRST_NAME + ' ' + MUD.LAST_NAME)
AS NAME FROM USER_TABLE
SELECT
[CREATED_ON],
MUD.PK_ID AS USER_ID,
(MUD.FIRST_NAME + ' ' + MUD.LAST_NAME) AS [NAME]
FROM
USER_TABLE
The parentheses around the expression MUD.FIRST_NAME + ' ' + MUD.LAST_NAME
are optional. 表达式MUD.FIRST_NAME + ' ' + MUD.LAST_NAME
是可选的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.