if(ca_coupon_id is null, 0, size(ca_coupon_id)) as m_coupon_available_num
The meaning of if(a, b, c)
under MySQL is: if the value of the first expression is TRUE
(not 0
or null
), then return the value of the second parameter, otherwise return the third The value of each parameter.
the data type in the size()
function should be map or list, and ca_coupon_id
is of type String
, and the same problem remains behind.
ca_coupon_id
array <string>
) and rebuild the table.ca_coupon_id
) to length (ca_coupon_id
), note that it is not len()
, usually the length of the string can be obtained through len
, but I am not feasible here, I don't know why.