我有以下 2 个查询,可以找到每月股票的平均价格
查询1:从上午9.30到下午1.30一个月的平均价格
查询2:从上午1.30到下午2.30一个月的平均价格
我需要划分差异和价格变化百分比
查询1
--- 9.30 to 1.30 prices ---
select DATE_FORMAT(transact_time,'%Y %M %d'),sum(price*qty)/sum(qty)
from trades1
where symbol='GREG.N0000'
and transact_time between '2013-01-01' and '2013-01-31'
and DATE_FORMAT(transact_time,'%T') between '09:30:00' and '13:30:00'
group by DATE_FORMAT(transact_time,'%Y %M %d')
查询2
--- 1.30 TO 2.30 prices ---
SELECT DATE_FORMAT(transact_time,'%Y %M %d'),SUM(price*qty)/SUM(qty)
FROM trades1
WHERE symbol='GREG.N0000'
AND transact_time BETWEEN '2013-01-01' AND '2013-01-31'
AND DATE_FORMAT(transact_time,'%T') BETWEEN '13:30:00' AND '14:30:00'
GROUP BY DATE_FORMAT(transact_time,'%Y %M %d')
我需要获取 query1 的结果和 query2 的结果的差异以及价格变化百分比。有人请帮我解决这个问题。