开发者

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. The query which is used by me is give开发者_开发问答n below but it gives error as Incorrect syntax near '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'. e.g.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜