---to buy statistics query
--Buy new-day trips
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
--Buy new-total number of visitors
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
--Buy new-day amount
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 '
--Buy new-Cumulative total amount
UNION ALL Select SUM (amount) from hur_product_buy where createdate between ' 1980-01-01 ' and ' 2016-07-11 23:59:59 '
--Buy your own exit-day trips
UNION ALL Select COUNT (*) from (SELECT distinct UserID from Hur_product_buy where (status=2 or status=3) and updatedate bet Ween ' 2016-07-11 00:00:00 ' and ' 2016-07-11 23:59:59 ') as C
--Buy your own exit-cumulative total number of passengers
UNION ALL Select COUNT (*) from (SELECT distinct UserID from Hur_product_buy where (status=2 or status=3) and updatedate bet Ween ' 1980-01-01 ' and ' 2016-07-11 23:59:59 ') as D
--Buy your own exit-the amount of the day
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 '
--Buy your own exit-cumulative total Amount
UNION ALL Select SUM (amount) from Hur_product_buy where (status=2 or status=3) and updatedate between ' 1980-01-01 ' and ' 20 16-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 STA tus=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 STA tus=3)
---to buy statistics query