URL: https://www.overclockers.at/coding-stuff/sql-befehl_fuer_new_posts_132521/page_1 - zur Vollversion wechseln!
also, da ich grad das phpbb nach meinen wünschen formatier brauch ich folgendes:
genau das, was ihr auch auf der linken seite habt - das new posts...
so weit hab ich schon das:
Code: PHPSELECT t.topic_title, u.username, p.post_time FROM `posts` p LEFT JOIN topics t USING ( topic_id ) LEFT JOIN users u ON u.user_id = p.poster_id ORDER BY p.post_time DESC LIMIT 0 , 7
"select DISTINCT" und dann deins
Code: PHPSELECT DISTINCT t.topic_title, u.username, p.post_time FROM `posts` p LEFT JOIN topics t USING ( topic_id ) LEFT JOIN users u ON u.user_id = p.poster_id ORDER BY p.post_time DESC LIMIT 0 , 7
a group by t.topic_title gehört vors order by
und beim select max(p.post_time)
bei u.username und gehört noch a 2. aggregatfunktion. aba da fällt ma jez nix ein.
edit also so ähnlich:
Code: PHPSELECT DISTINCT t.topic_title, u.username, max(p.post_time) FROM `posts` p LEFT JOIN topics t USING ( topic_id ) LEFT JOIN users u ON u.user_id = p.poster_id group by t.topic_title, u.username ORDER BY p.post_time DESC LIMIT 0 , 7
Code: PHPSELECT DISTINCT t.topic_id, t.topic_title, max(p.post_id), u.username, max(p.post_time) FROM `posts` p INNER JOIN topics t ON t.topic_last_post_id = p.post_id INNER JOIN users u ON u.user_id = p.poster_id GROUP BY t.topic_id, t.topic_title, u.username ORDER BY p.post_time DESC LIMIT 0 , 7

bei oc funkt das aber anders - und zwar über den thread-table, alles andere tät zu viel peromance schlucken 
overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2026