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

Froschpopo
 2004-08-05 15:52
#32506 #32506
User since
2003-08-15
2653 Artikel
BenutzerIn
[default_avatar]
ne also tut mir leid, so klappt das nicht.

ich möchte also z.B. wissen, wieviele Einträge gestern und vorgestern getätigt wurden:
Code: (dl )
1
2
3
4
5
6
7
8
my $sth_prepare = $dbh1->prepare("SELECT datediff(now(),datestamp) AS days_ago, count(datediff(now(),datestamp) ) AS count_days FROM userlog group by 2");
$sth_prepare->execute() or die $DBI::errstr;

print "Content-Type: text/html\n\n";

for ($sth_prepare->fetchrow_array()) {
  print $_."\n";
}

warum krieg ich dann:

You have an error in your SQL syntax near '(now(),timestamp) AS days_ago, count(datediff(now(),timestamp) ) AS count_days, ' at line 1 at /usr/local/httpd/cgi-bin/diagramm.pl line 30.

???\n\n

<!--EDIT|Froschpopo|1091706807-->

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