SELECT SUM(give_num-have_used_num)
FROM a
WHERE customer_id=#{myCustomerId}
AND (date_add(create_date, interval enable_days_num day) >= CURRENT_DATE() OR enable_type=3)
2. 判断字段值,进行替换,最后as别名,实体类接收
CASE
WHEN t.task_status = '1' THEN '已完成'
WHEN t.task_status = '2' THEN '未完成'
END AS task_status
3. 拼接字段值,最后as别名,实体类接收
CONCAT(u.nick_name,'[',p.POSITION_NAME,']') AS name