i'm writing a simple message board. i have 2 tables:
topics_tbl -- topic_id
posts_tbl -- post_id / topic_id / date
(stripped down)
so for each record in topics_tbl, there will be several for it in posts_tbl, referencing it with the topic_id key.
i want a query that will return a row for each topic, with the most recent date from posts_tbl ... if you get what i mean. i came up with this ...
SELECT topics_tbl., posts_tbl.
FROM topics_tbl
LEFT JOIN posts_tbl USING (topic_id)
GROUP BY topics_tbl.topic_id ORDER BY posts_tbl.date DESC
... but it doesn't show the most recent date from posts_tbl. i can't think where the solution lies ... the join is occuring at the first match it finds 🙁