0
点赞
收藏
分享

微信扫一扫

mysql 空值处理和值替换

四月天2021 2022-02-12 阅读 117
SELECT user_profile.device_id,user_profile.university,IFNULL(B.question,0),IFNULL(B.RIGHT_QUESTION,0) FROM user_profile LEFT JOIN (
SELECT device_id, COUNT(*) AS question,sum((case when result='right' then 1 else 0 end)) as RIGHT_QUESTION 
FROM question_practice_detail WHERE month(date)=8 GROUP BY device_id) 
AS B ON user_profile.device_id=B.device_id WHERE user_profile.university="复旦大学" 
举报

相关推荐

0 条评论