问题一:
1、$array数组如下:
array (size=7)
1 => string '2018-09-21' (length=10)
2 => string '2018-09-22' (length=10)
3 => string '2018-09-23' (length=10)
4 => string '2018-09-24' (length=10)
5 => string '2018-09-25' (length=10)
6 => string '2018-09-26' (length=10)
7 => string '2018-09-27' (length=10)
2、$list数组如下:
array (size=3)
0 =>
array (size=2)
'riqi' => string '2018-09-21' (length=10)
'count' => int 2
1 =>
array (size=2)
'riqi' => string '2018-09-26' (length=10)
'count' => int 2
2 =>
array (size=2)
'riqi' => string '2018-09-27' (length=10)
'count' => int 3
求助:如何php实现以下效果
array (size=3)
0 =>
array (size=2)
'riqi' => string '2018-09-21' (length=10)
'count' => int 2
1 =>
array (size=2)
'riqi' => string '2018-09-22' (length=10)
'count' => int 0
2 =>
array (size=2)
'riqi' => string '2018-09-23' (length=10)
'count' => int 0
3 =>
array (size=2)
'riqi' => string '2018-09-24' (length=10)
'count' => int 0
4 =>
array (size=2)
'riqi' => string '2018-09-25' (length=10)
'count' => int 0
5 =>
array (size=2)
'riqi' => string '2018-09-26' (length=10)
'count' => int 2
6 =>
array (size=2)
'riqi' => string '2018-09-27' (length=10)
'count' => int 3
问题二:
现有sql如下:
select FROM_UNIXTIME(addtime,'%Y-%m-%d') as riqi, count(1) as count from order where FROM_UNIXTIME(addtime,'%Y-%m-%d') >= now() - interval 7 day group by FROM_UNIXTIME(addtime,'%Y-%m-%d')
如何能通过一句sql实现以下效果
array (size=3)
0 =>
array (size=2)
'riqi' => string '2018-09-21' (length=10)
'count' => int 2
1 =>
array (size=2)
'riqi' => string '2018-09-22' (length=10)
'count' => int 0
2 =>
array (size=2)
'riqi' => string '2018-09-23' (length=10)
'count' => int 0
3 =>
array (size=2)
'riqi' => string '2018-09-24' (length=10)
'count' => int 0
4 =>
array (size=2)
'riqi' => string '2018-09-25' (length=10)
'count' => int 0
5 =>
array (size=2)
'riqi' => string '2018-09-26' (length=10)
'count' => int 2
6 =>
array (size=2)
'riqi' => string '2018-09-27' (length=10)
'count' => int 3
白板的微信
凤凰求蛊
12345678_0001