I’m using a view as a table to join data on 3 tables:
create view category_list as
select forum_categories.*, max( forum_answer.a_id ) as latest_answer_id
from forum_categories
left join forum_question on forum_question.catid = forum_categories.id
left join forum_answer on forum_answer.question_id = forum_question.id
and forum_answer.qtitle = forum_question.topic;
However, I am experiencing two problems:
- Only one record from forum_categories is pulled out to be linked with
- I am unable to associate forum_answer.qtitle with forum_question.topic
please advise 🙂
Thanks.
The group by clause is missing. Here’s a very simple example I put together, and below it the sql I used to create the simple test data.