-- 素材字段分析
-- 分析各渠道的素材字段填充情况
-- 素材字段：文章标题、分享标题（卡片标题）、分享封面（卡片封面）

SELECT  dt
        ,channel
        ,COUNT(*) AS 记录数
        ,SUM(CASE WHEN 文章标题 IS NOT NULL AND 文章标题 != '' THEN 1 ELSE 0 END) AS 有文章标题
        ,SUM(CASE WHEN 分享标题 IS NOT NULL AND 分享标题 != '' THEN 1 ELSE 0 END) AS 有卡片标题
        ,SUM(CASE WHEN 分享封面 IS NOT NULL AND 分享封面 != '' THEN 1 ELSE 0 END) AS 有卡片封面
FROM    loghubods.opengid_base_data
WHERE   dt >= ${start}
AND     dt <= ${end}
AND     usersharedepth = 0
AND     videoid IS NOT NULL
GROUP BY dt, channel
ORDER BY dt, 记录数 DESC
;
