select DATE_FORMAT(now(),'%m/%Y') as time,avg(kW) as kW from (
select avg(kW) as kW from all_dc_minute
where time between '2012-3-29 00:00:00' and '2012-3-29 23:59:59'
union all
select avg(kW) as kW from all_dc_day
where time between '2012-3-1' and '2012-3-28'
)tbl ;这条查询语句有2条子语句
1.求今天的kw平均值 结果 50
2.求本月的前面28天平均值 结果100
总结果为75
但是我想要的是本月29天的平均值
在线急求
select avg(kW) as kW from all_dc_minute
where time between '2012-3-29 00:00:00' and '2012-3-29 23:59:59'
union all
select avg(kW) as kW from all_dc_day
where time between '2012-3-1' and '2012-3-28'
)tbl ;这条查询语句有2条子语句
1.求今天的kw平均值 结果 50
2.求本月的前面28天平均值 结果100
总结果为75
但是我想要的是本月29天的平均值
在线急求
select DATE_FORMAT(now(),'%m/%Y') as time,avg(kW) as kW from all_dc_day
where time between '2012-3-1' and '2012-3-29'
select * from b1
union all
select * from b2)
where
time between '2012-3-1' and '2012-3-29'