Nicht ganz sicher, was ich vermisse, aber meine SQL-Anweisung gibt nur eine Zeile zurück.SQL Join nur 1 Zeile zurückgeben
SELECT
tl.*,
(tl.topic_total_rating/tl.topic_rates) as topic_rating,
COUNT(pl.post_id) - 1 as reply_count,
MIN(pl.post_time) AS topic_time,
MAX(pl.post_time) AS topic_bump
FROM topic_list tl
JOIN post_list pl
ON tl.topic_id=pl.post_parent
WHERE
tl.topic_board_link = %i
AND topic_hidden != 1
ORDER BY %s
Ich habe zwei Tabellen (post_list und topic_list) und post_parent Links der post_list zu einem topic_id der topic_list.
Anstatt alle Themen zurückzugeben (wo der topic_board_link ihres Boards n ist), wird nur ein Thema zurückgegeben.
relevante Teile von CREATE TABLE, einschließlich PK/FK-Definitionen. – Ronnis
PK von post_list ist post_id, PK von topic_list ist topic_id. Ich habe keine FKs (glaube ich). –