FirstName, LastName in SQL, too complex?

前端 未结 3 1394
無奈伤痛
無奈伤痛 2021-01-01 05:07

This SQL seems complex, is there an easier way to get FirstName, LastName when one or both of the fields can be NULL?

SELECT COALESCE(LastName,\'\')+
                


        
3条回答
  •  有刺的猬
    2021-01-01 05:38

    I don't think this is complex at all... On MSSQL you can do something like

    SELECT Isnull(LastName,'') + ', ' + Isnull(FirstName,'')
    FROM Person
    

提交回复
热议问题