mysql coalesce
#Avoid sum null
SELECT SUM(COALESCE(field_with_null_values, 0)) as s FROM tablename
#Avoid concat string null
SELECT CONCAT(name_never_null, ' ', COALESCE(surname_with_null_values, '')) as complete_name FROM users
mysql coalesce
#Avoid sum null
SELECT SUM(COALESCE(field_with_null_values, 0)) as s FROM tablename
#Avoid concat string null
SELECT CONCAT(name_never_null, ' ', COALESCE(surname_with_null_values, '')) as complete_name FROM users
coalesce mysql
The COALESCE() function returns the first non-null value in a list.
Example : SELECT COALESCE(NULL, NULL, 'W3Schools.com', NULL, 'Example.com');
output : 'W3Schools.com'
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us