Thread MySQL: traffic daten zusammenfassen (2 answers)
Opened by esskar at 2009-06-15 16:21

pq
 2009-06-15 16:28
#122510 #122510
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
Code: (dl )
1
2
3
4
5
6
7
SELECT
YEAR(timestamp) as year,
SUM( IF(direction=1, bytes, 0) ) as Upload,
SUM( IF(direction=2, bytes, 0) ) as Download,
SUM( bytes )
FROM table
GROUP BY year

year kannst du sicher noch selber auf year/month umändern...
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread MySQL: traffic daten zusammenfassen