Union All不返回相同的行数

时间:2014-04-01 21:16:02

标签: mysql sql

我有一个使用union all的SQL查询。当我运行以下查询时,只返回一行NULL值的行(该值为null,因为该时间段没有数据)。期望是返回2行null。是什么给了什么?

SELECT 
  SUM(val) AS GA 
FROM
  mytable 
WHERE region = 'someRegion' 
  AND ACTIVITY_MTH BETWEEN '2014-04-01' AND '2014-04-30' 

UNION
ALL 

SELECT 
  quota 
FROM
  budgetTable 
WHERE sales_id = 'someRegion' 
  AND start_date = '2014-04-01' 
  AND metric_id = 1 

0 个答案:

没有答案