Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[mysql] group by dayname schneidet "donnerstag" ab
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
plasmagunman
l33t
l33t


Joined: 07 Jun 2002
Posts: 604
Location: berlin

PostPosted: Fri Apr 27, 2007 5:53 am    Post subject: [mysql] group by dayname schneidet "donnerstag" ab Reply with quote

okay, komplett gentoo-unrelated:

ich hab' da gerade so eine tabelle, in der in einer spalte unix timestamps stehen. nun möchte ich die einträge nach wochentagen aufgeschlüsselt zählen, also ein:
Code:
SELECT DAYNAME(FROM_UNIXTIME(`timestamp`)) as `whatever` , COUNT(*) FROM `test_table` GROUP BY `whatever`;

das klappt auch alles ganz gut, bis ich das ganze in deutsch haben möchte, also
Code:
SET lc_time_names = 'de_DE';

leider schreibt er nur "donnersta" und lässt das "g" weg. bei einem einfachen
Code:
SELECT DAYNAME(FROM_UNIXTIME(`timestamp`)) FROM `test_table`;
wird der "donnerstag" korrekt geschrieben, erst mit dem "GROUP BY" geht's kaputt.

bei reinen text- oder varchar-spalten schneidet "GROUP BY" nichts ab, ich hab' das verhalten bisher nur bei der kombination GROUP BY DAYNAME gesehen.

hätte da vielleicht irgendjemand einen tip was man da machen könnte?

[edit] man sollte so früh morgens keine posts schreiben, vor allem nicht, wenn man die nacht durchprogrammiert hat ;-) . es hadelt sich um mysql 5.0.27 [/edit]
_________________
please, feel free to correct my english. - por favor, corrige mi español.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3925
Location: Hamburg

PostPosted: Fri Apr 27, 2007 9:58 am    Post subject: Reply with quote

bei mir nicht:
Code:
mysql> SET lc_time_names = 'de_DE';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT DAYNAME(FROM_UNIXTIME('timestamp')) as 'whatever';
+------------+
| whatever   |
+------------+
| Donnerstag |
+------------+
1 row in set, 1 warning (0.00 sec)

Ich habe dev-db/mysql-5.0.38, Frühaufsteher ;)
Back to top
View user's profile Send private message
plasmagunman
l33t
l33t


Joined: 07 Jun 2002
Posts: 604
Location: berlin

PostPosted: Fri Apr 27, 2007 10:05 am    Post subject: Reply with quote

so klappt das bei mir auch. das "g" wird erst abgechnitten wenn ich noch ein "GROUP BY `whatever`" ranhänge.
_________________
please, feel free to correct my english. - por favor, corrige mi español.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3925
Location: Hamburg

PostPosted: Fri Apr 27, 2007 10:59 am    Post subject: Reply with quote

Ah ja, und so ist es bei mir:
Code:
mysql> SELECT DAYNAME(FROM_UNIXTIME('timestamp')) as 'whatever' , COUNT(*) FROM tab01 GROUP BY 'whatever';
+------------+----------+
| whatever   | COUNT(*) |
+------------+----------+
| Donnerstag |        3 |
+------------+----------+
1 row in set, 1 warning (0.00 sec)

mysql> desc tab01
    -> ;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.07 sec)

Back to top
View user's profile Send private message
plasmagunman
l33t
l33t


Joined: 07 Jun 2002
Posts: 604
Location: berlin

PostPosted: Sat Apr 28, 2007 9:18 pm    Post subject: Reply with quote

strange, ich glaub' ich muss mir die konfiguration des servers noch mal angucken. witzigerweise schneidet "DATE_FOMRMAT( ,"%W")" das g nicht ab. sehr seltsam das...
_________________
please, feel free to correct my english. - por favor, corrige mi español.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum