常用sql

按日期累加

SELECT b.`date` ,(SELECT SUM(price) FROM bkk a WHERE a.`date`<= b.`date` ) FROM bkk b

======================================================================================

SELECT a.`date`,COUNT(numberId)"点击人数",
(SELECT COUNT(numberId) FROM buy WHERE buy.`date`= a.`date`)"购买人数",
(SELECT COUNT(numberId) FROM pay WHERE pay.`date`= a.`date`)"付款人数"
FROM product a GROUP BY a.`date`

  product 

buy

pay

 

 

posted @ 2016-07-03 11:08  王八一瓶子  阅读(102)  评论(0编辑  收藏  举报