列串联返回“ Null”。 MySQL-PHP [英] Column concatenation returns "Null" Mysql - Php
本文介绍了列串联返回“ Null”。 MySQL-PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用以下代码来连接值
I can able to concatenate the values using the following code
$sqlselect = "UPDATE billing_details SET SRF = CONCAT(Year, ID)";
,但返回的结果值为 NULL。请帮助我解决此问题
but it returns the result value as "NULL". Kindly help me to solve this issue
表结构:
Year *Varchar(5)*
ID *Int(10)*
SRF *Varchar(100)*
结果表:
推荐答案
MySql CONCAT函数返回 NULL
如果有任何参数值(如果为空值),请参见打击
MySql CONCAT function is return NULL
if any argument value if null value, see blow
SELECT COCAT(NULL, 1)
或
OR
SELECT COCAT(1, NULL)
> NULL
如果您想在其他参数值都为null的同时保留其他值,请使用IFNULL()函数排除NULL值
If you want to keep other values while any argument value have null then use IFNULL() function to exclude NULL values
在查询中 >
$sqlselect = "UPDATE billing_details SET SRF = CONCAT(IFNULL(Year, ''), IFNULL(ID, ''))";
这篇关于列串联返回“ Null”。 MySQL-PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文