Duras666: MySQL-abfrage... wie muss ichs machen?

Beitrag lesen

Hi zusammen!

Habe folgende tabelle:
+--+--------+-------+----+-----+
|id|tothread|forumid|byid|datum|
+--+--------+-------+----+-----+
| 1|       1|      1|   7| egal|
+--+--------+-------+----+-----+
| 2|       1|      1|   7| egal|
+--+--------+-------+----+-----+
| 3|       2|      1|   7| egal|
+--+--------+-------+----+-----+
| 4|       3|      5|   7| egal|
+--+--------+-------+----+-----+
Will jetzt eine abfrage machen bei der folgendes rauskommt:

3 Zeilen (WHERE forumid = '1') mittels mysql_affected_rows()
anzahl der unterschiedlichen werte bei tothread (also 1,2 -> demnach 2)
die felder id, tothread, byid, datum
hatte es so versucht:
SELECT id, tothread, byid, datum, count(DISTINCT(tothread)) as threads FROM foren_posts WHERE forumid = '$row2[id]' GROUP BY id

funktioniert auch so weit: die felder werden ausgelesen, 3 zeilen, NUR:
count(DISTINCT(tothread)) as threads  ergibt immer 1, obwohl da doch 2 unterschiedliche zeilen drin sind :(

wer kann helfen?