---随心买统计查询

---随心买统计查询

--随心买新增-当日人次
select COUNT(*) from(select distinct userID from HUR_Product_Buy where createDate between '2016-07-12 00:00:00' and '2016-07-12 23:59:59') as a
--随心买新增-累计总人次
union all select COUNT(*) from(select distinct userID from HUR_Product_Buy where createDate between '1980-01-01' and '2016-07-12 23:59:59') as b

--随心买新增-当日金额
union all select SUM(amount) from HUR_Product_Buy where createDate between '2016-07-11 00:00:00' and '2016-07-11 23:59:59'
--随心买新增-累计总金额
union all select SUM(amount) from HUR_Product_Buy where createDate between '1980-01-01' and '2016-07-11 23:59:59'


--随心买退出-当日人次
union all select COUNT(*) from(select distinct userID from HUR_Product_Buy where (status=2 or status=3) and updateDate between '2016-07-11 00:00:00' and '2016-07-11 23:59:59') as c
--随心买退出-累计总人次
union all select COUNT(*) from(select distinct userID from HUR_Product_Buy where (status=2 or status=3) and updateDate between '1980-01-01' and '2016-07-11 23:59:59') as d

--随心买退出-当日金额
union all select SUM(amount) from HUR_Product_Buy where (status=2 or status=3) and updateDate between '2016-07-12 00:00:00' and '2016-07-12 23:59:59'
--随心买退出-累计总金额
union all select SUM(amount) from HUR_Product_Buy where (status=2 or status=3) and updateDate between '1980-01-01' and '2016-07-12 23:59:59'

 

 

 


select * from(
select ext.exitID,ext.exitAmount,ext.createDate,ext.exitStatus,
(select username from YYD_Users_RegInfo where id = ext.userID) username,
(select amount from HUR_Product_Buy where buyID = ext.buyID) amount,
(select rankName from HUR_Product_Buy where buyID = ext.buyID) rankName
from HUR_Product_Exit as ext) as data where 1=1

select * from HUR_Product_Buy order by createDate desc

select SUM(amount) as TotalextAmount from(select buy.buyID,buy.amount,buy.status,buy.platform,buy.updateDate,
(select username from YYD_Users_RegInfo where id = buy.userID) username from HUR_Product_Buy as buy where (status=2 or status=3)) as data

where username like '%dd%'


select buy.buyID,buy.amount,buy.status,buy.platform,buy.updateDate,
(select username from YYD_Users_RegInfo where id = buy.userID) username from HUR_Product_Buy as buy where (status=2 or status=3)



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值