我有以下SQL:
---------------------- ---------------------- ---------------------- ----------------------
46.6003444444471 44.6003444444471 -121.595008332994 -123.595008332994
(1 row(s) affected)
Id ExifGpsLatitude ExifGpsLongitude
----------- ---------------------- ----------------------
(0 row(s) affected)
Id ExifGpsLatitude ExifGpsLongitude
----------- ---------------------- ----------------------
3 34.0472027778625 -118.437966666751
5 34.0727111111747 -118.358672222031
7 34.0327305560642 -118.451605555614
9 34.0319777774811 -118.455574999915
11 34.0473527781169 -118.437897222307
13 45.5958944447835 -122.591369444529
15 45.5907861110899 -122.593613888423
17 45.6003444444471 -122.595008332994
(8 row(s) affected)
结果是上周点击的总和。
示例源数据:
SELECT count(clics)
FROM clicscount
WHERE date > CURDATE() - INTERVAL 1 WEEK
显示的结果为Thursday: 5 clics
Friday: 5 clics
Saturday: 5 clics
Sunday: 5 clics
Monday: 5 clics
Tuesday: 5 clics
Wednesday: 5 clics
Today: 5 clics
,因为该功能显示所有点击的总和。
但是,我希望每天以点击数组显示数据,例如:
40
答案 0 :(得分:2)
你可以这样做:
SELECT GROUP_CONCAT(tmp.c SEPARATOR ',')
FROM (
SELECT count(clics) c
FROM clicscount
WHERE date > CURDATE() - INTERVAL 1 WEEK
GROUP BY date
) as tmp;
答案 1 :(得分:0)
$i=0;
while($i < 8){
$result[$i]=SELECT count(clics) FROM clicscount WHERE date = CURDATE()-$i;
$i++;
}
$ result是必需的数组。