Home > database >  After buying rate
After buying rate

Time:09-25

Known two tables, table trading order (ordercode order number, storecode stores, customerID membership number, the sales amount of consumption, buytime buy time)
Order products association table product (ordercode order number, sku number, product qty purchase quantity)
1 o purchase 2018 customers in the first purchase within one month after purchase, the number of
2 in 2018 after buying rate and average purchase cycle

CodePudding user response:

Is the definition of "2018 purchase customers" is what?

CodePudding user response:

reference 1/f, started the first response:
could you please tell me the definition of "2018 purchase customers" what is it?
in 2018 for the first time to buy

CodePudding user response:

 
2018-1 o purchase customers in the first purchase within one month after purchase, the number of
The select customerID=count (distinct a.c ustomerID)
The from [order] a
Inner join (select customerID,
Firstbuytime=min (buytime)
The from [order]
Group by customerID) b on a.c ustomerID=biggest ustomerID
Where b. irstbuytime between '2018-01-01' and '2018-12-31 s'
And the exists (select 1
The from [order] c
Where Arthur c. ustomerID=a.c ustomerID
And mount uytime<=dateadd (m, 1, b. irstbuytime))
  • Related