Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在字段可能为空或不为空的列上运行 CONCAT。如果该字段不为空,则没有问题,即如果 A 列中的字段等于 a:
SET A = CONCAT(A, '_b')
给出 a_b。问题是,如果 A 列中的字段为空,则 concat 不会返回任何内容。即使字段为空,有没有办法连接它,在这个例子中,它会返回'_b'?
在 Sql 服务器中
SET A = CONCAT(isnull(A,''), '_b')
IFNULL在 Mysql 中使用。
IFNULL
根据不同的数据库引用不同的函数