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

foobar
 2004-08-05 16:15
#32507 #32507
User since
2003-08-04
69 Artikel
BenutzerIn
[default_avatar]
[QUOTE]
SELECT datediff(now(),datestamp) AS days_ago, count(datediff(now(),datestamp) ) AS count_days FROM userlog group by 2
[/QUOTE}
Das ist auch nicht das was ich gepostet habe. So sollte es funktionieren:
[sql]SELECT datediff(now(),datestamp) AS days_ago, count(datediff(now(),datestamp) ) AS count_days FROM userlog group by days_ago
[/sql]
Wenn du nur die Einträge eines bestimmten tages haben möchtest z.b. heute, dann kannst du das Statement noch um ein HAVING erweitern:
[sql]SELECT datediff(now(),datestamp) AS days_ago, count(datediff(now(),datestamp) ) AS count_days FROM userlog group by days_ago
Having days_ago = 0
[/sql]
The three chief virtues of a programmer are: Laziness, Impatience and Hubris
[Larry Wall]

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