Hallo, bin hier neu und komme direkt mit einem
verflixten sql Problem abgekrochen.
Ich versuche alle Foren, die unter dem Forum der id 1 liegen
abzurufen mit samt Anzahl der Themen, die sich innerhalb
dieses Forums befinde und der Anzahl der Beiträgen je Thema.
Das klappt schonmal nicht...
Die sub-Spalte bei sj_forums gibt an, unter welchem anderen
Forum dieses liegt. Die sub-Spalte in der sj_topics-Tabelle gibt
an, in welchem Forum das Thema liegt. Und die sub-Spalte der
sj_posts-Tabelle gibt an, in welchem thema sich der Beitrag
befindet. Ich arbeite hier nach dem Vaterzeiger-Prinzip.
Ich glaube nicht, dass Nested Sets hier angebracht währen
geschweige denn beherrsche das Prinzip.
Wie bekomme ich so eine Abfrage jetzt hin?
Help!
verflixten sql Problem abgekrochen.
Ich versuche alle Foren, die unter dem Forum der id 1 liegen
abzurufen mit samt Anzahl der Themen, die sich innerhalb
dieses Forums befinde und der Anzahl der Beiträgen je Thema.
Code:
SELECT sj_forums.title, sj_forums.desc, sj_topics.COUNT(*) AS c_topics, sj_posts.COUNT(*) AS c_posts FROM sj_forums, sj_topics, sj_posts WHERE sj_forums.sub=0 AND sj_topics.sub=sj_forums.id AND sj_posts.sub=sj_topics.id ORDER BY sj_forums.pos ASC
Code:
Fehler SQL-Befehl: Dokumentation SELECT sj_forums.title, sj_forums.desc, sj_topics.COUNT( * ) AS c_topics, sj_posts.COUNT( * ) AS c_posts FROM sj_forums, sj_topics, sj_posts WHERE sj_forums.sub =0 AND sj_topics.sub = sj_forums.id AND sj_posts.sub = sj_topics.id ORDER BY sj_forums.pos ASC LIMIT 0 , 30 MySQL meldet: Dokumentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* ) AS c_topics , sj_posts.COUNT ( * ) AS c_posts FROM sj_forums , sj_topics , ' at line 1
Forum dieses liegt. Die sub-Spalte in der sj_topics-Tabelle gibt
an, in welchem Forum das Thema liegt. Und die sub-Spalte der
sj_posts-Tabelle gibt an, in welchem thema sich der Beitrag
befindet. Ich arbeite hier nach dem Vaterzeiger-Prinzip.
Ich glaube nicht, dass Nested Sets hier angebracht währen
geschweige denn beherrsche das Prinzip.
Wie bekomme ich so eine Abfrage jetzt hin?
Help!
Comment