`

mysql 日期查询

阅读更多

 

select

(select FORMAT(SUM(amount),0)  from  bee_bills b where b.status=1 ) '总交易额',
(select FORMAT(SUM(amount),0)  from  bee_bills b where b.status=1 and  DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') )  '今日交易额',
(select COUNT(distinct(member_id)) from bee_bills b where b.status=1 and  DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') )  '今日投资人数',
(select COUNT(*) from bee_member m where  DATE_FORMAT(create_date,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') ) '新增注册用户数',
(select FORMAT(SUM(amount),0)   from bee_bills b  where b.status=1 and  DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')	
	and b.member_id in (
		select id from bee_member m where  DATE_FORMAT(create_date,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') 
	)   
   ) '新增用户交易额'
   



select DATE_FORMAT(NOW(),'%Y-%m-%d')

 



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics