文章目录
-
- 原题题目
- 代码实现(首刷自解)
原题题目
代码实现(首刷自解)
# Write your MySQL query statement below
SELECT SUM(b.apple_count+if(c.chest_id is NULL,0,c.apple_count)) AS apple_count,SUM(b.orange_count+if(c.orange_count is NULL,0,c.orange_count)) AS orange_count
FROM Boxes AS b LEFT JOIN Chests AS c ON b.chest_id = c.chest_id