Thread GROUP BY Timestamp ?: Tag bei Timestamp herausfinden (30 answers)
Opened by Froschpopo at 2004-08-05 08:00

Froschpopo
 2004-08-05 21:08
#32530 #32530
User since
2003-08-15
2653 Artikel
BenutzerIn
[default_avatar]
ich dachte da an sowas in der Richtung:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
my $sth_prepare = $dbh1->prepare("select datestamp, count(id) from userlog group by substring(datestamp,1,10) order by datestamp asc limit 0,12");
$sth_prepare->execute() or die $DBI::errstr;

my $day_now;
my $day_old;
my $dif = 1;
my @dif_array = ();

while (my @arr2 = $sth_prepare->fetchrow_array()) {
$day_now = substr($arr2[0],8,2);
$dif = $day_now - $day_old;
push @dif_array, $dif;
for (@dif_array) {
push @array, 0 if $_>1;
}
push @array, $arr2[1];
$day_old = $day_now;
}

kann das funktionieren?

View full thread GROUP BY Timestamp ?: Tag bei Timestamp herausfinden