mysql左连接及case when用法

SELECT
	t1.id,
	t1.channel_id,
	t1.sum_amount,
	t1.sum_date,
	t1.msisdn_num,
	t2.num,
	t2.id AS channel_complaint_id,
  case 
    when t2.num is not null then t2.num/(t1.msisdn_num*100)
    else null end scale
FROM
	ddo_channel_statistics_day t1
LEFT JOIN ddo_channel_complaint_day t2 ON t1.channel_id = t2.channel_id
AND t1.sum_date = t2.sum_date


你可能感兴趣的:(mysql,case,when,左连接)