If both columns can contain NULL, but you still want to merge them to a single string, the easiest solution is to use CONCAT_WS():SELECT FirstName AS First_Name , LastName AS Last_Name , CONCAT_WS('', ContactPhoneAreaCode1, ContactPhoneNumber1) AS Contact_Phone FROM TABLE1通过这种方式,您不必分别检查每列的NULL -ness.This way you won't have to check for NULL-ness of each column separately.或者,如果两列都实际定义为NOT NULL,则 CONCAT() 就足够了:Alternatively, if both columns are actually defined as NOT NULL, CONCAT() will be quite enough:SELECT FirstName AS First_Name , LastName AS Last_Name , CONCAT(ContactPhoneAreaCode1, ContactPhoneNumber1) AS Contact_Phone FROM TABLE1对于COALESCE来说,它有点不同:在给出参数列表的情况下,它返回不是NULL的第一个参数.As for COALESCE, it's a bit different beast: given the list of arguments, it returns the first that's not NULL. 这篇关于MySQL SELECT AS将两列合并为一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-18 19:20