Autor | Beitrag |
---|---|
neokataMi 28.5.08, 11:16 | hallo. ich bi verzwiflet. ![]() Zitat: s problem drbi isch, dass zur tabelle forum_threads insgesamt 3 beziehige zu de tabellene forum_posts, user und forum_bereiche hergstellt wärde sölle. mit INNER JOIN weissi aber nur wies mit max. 2 tabellene got. chamr do öber hälfe? SELECT thema, user.nickname, new_date, forum_threads.threadid, new_name, admin, kategorie, forum_bereiche.titel, count(forum_posts.postid) AS anzahl FROM forum_bereiche INNER JOIN (forum_threads INNER JOIN forum_posts, user ON user.id = forum_threads.new_name AND forum_posts.threadid = forum_threads.threadid) ON forum_threads.kategorie = forum_bereiche.id GROUP BY thema ORDER BY new_date DESC LIMIT 0,10 ![]() es handlet sich do um das: http://lansissach.net/?id=forum zum die lestchte fore-biträg uszläse 1 mal bearbeitet, zuletzt Mi 28.5.08, 11:25 |
elbenedettoMi 28.5.08, 11:18 | Bin nimmer so fit eventuell hilft das http://aktuell.de.selfhtml.org/artikel/datenbanken/fortgeschrittene-joins/mehrfachjoin1.ht m |
neokataMi 28.5.08, 11:23 | nei sorry, irgendwo wirds mr denn au zu kompliziert ![]() es got um folgendi drei beziehige eigentlich: Zitat: die drei müend enthalte si forum_threads.new_name = user.id forum_threads.threadid = forum_posts.threadid forum_threads.kategorie = forum_bereiche.id ![]() 1 mal bearbeitet, zuletzt Mi 28.5.08, 11:24 |
holysmokeMi 28.5.08, 11:39 | hesch nit no d fehlermäldig? aso vom SQL, nit vom php |
quixMi 28.5.08, 11:44 | nachm select würd i jewils immer agäh um welli tabälle dass es bi de wärt goht (also SELECT thread.thema, etc) anstatt de "inner joins" würd i nachm FROM eifach d'tabälle uflischte, und die "verknüpfige" im where teil ine mache so öbe: FROM forum_bereiche, forum_threads, forum_posts, user WHERE user.id = forum_threads.new_name AND forum_posts.threadid = forum_threads.threadid AND forum_threads.kategorie = forum_bereiche.id GROUP BY thema ORDER BY new_date DESC LIMIT 0,10 hmm, jä, dringend überall d'tabälle-näme bi de fälder hinzuefüege!!! PS: das wasi gschriebe ha isch zwar kei diräkti lösig, aber so umgohsch vieli potenzielli problem 1 mal bearbeitet, zuletzt Mi 28.5.08, 11:48 |
neokataMi 28.5.08, 11:50 | genau stimmt mit WHERE's! messi ![]() |
neokataMi 28.5.08, 11:52 | Zitat: holysmoke #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 'ON user.id = forum_threads.new_name AND forum_posts.threadid = forum_threads.thr' at line 5 hesch nit no d fehlermäldig? aso vom SQL, nit vom php |
quixMi 28.5.08, 11:53 | anhand vo dr fählermäldig würd i die zwei beedingige nachm ON in e klammere mache, also: ON ( ... AND ... ) |
neokataMi 28.5.08, 11:54 | Zitat: klappt wunderbar, messi quix SELECT thema, user.nickname, new_date, forum_threads.threadid, new_name, admin, kategorie, forum_bereiche.titel, count( forum_posts.postid ) AS anzahl FROM forum_bereiche, forum_threads, forum_posts, user WHERE user.id = forum_threads.new_name AND forum_posts.threadid = forum_threads.threadid AND forum_threads.kategorie = forum_bereiche.id GROUP BY thema ORDER BY new_date DESC LIMIT 0 , 10 ![]() |
quixMi 28.5.08, 11:55 | hmmm das query ka me kum läse/verstoh, entsprächend könne schnäll fähler ine cho... schriebs um so wie in mim erschte post jä, genau so 1 mal bearbeitet, zuletzt Mi 28.5.08, 11:55 |
neokataMi 28.5.08, 11:57 | http://lansissach.net/?id=forum voila ![]() |