好友
阅读权限10
听众
最后登录1970-1-1
|
楼主|
井芝羽
发表于 2021-9-14 13:29
本帖最后由 井芝羽 于 2021-9-14 15:20 编辑
或者按照下面脚本的方式一列一列输出写个SQL脚本处理,恳请老师出手帮忙,谢谢!
--数据源格式:TranID int,Time text,Price real,Volume int,SaleOrderVolume int,BuyOrderVolume int,Type text,SaleOrderID int,SaleOrderPrice real,BuyOrderID int,BuyOrderPrice real
create table biao2 as select TranID
,Time as 时间
,Price / 100 as 价格 --单位元
,Volume as 成交 --单位股
,SaleOrderVolume as 委卖量 --单位股
,BuyOrderVolume as 委买量 --单位股
,Type as 方向
,SaleOrderID as 委卖ID
,SaleOrderPrice / 100 as 委卖价 --单位元
,BuyOrderID as 委买ID
,BuyOrderPrice / 100 as 委买价 --单位元
,SaleOrderPrice * SaleOrderVolume / 100 as 委卖额 --单位元
,BuyOrderPrice * BuyOrderVolume / 100 as 委买额 --单位元
,Volume * Price / 100 as 成交额 --单位元
from biao;
select sum(成交额) from (select 委买ID from biao2 group by 委买ID) ;
select sum(成交额) from (select 委卖ID from biao2 group by 委卖ID) ;
drop table biao;
drop table biao2;
vacuum; |
|