Building query over 3 tables
Posted: Sun Jul 15, 2007 9:20 am
Hi @all,
could someone help me to merge these two queries together, I can't by myself.
Getting the Topics
Now I also want the newest Post in the topic:
But how do these work together? I need to make some sort of subquery, but I just can't get it right. Later on I'll probably save the ID of the latest post in the topics table, but right now I need to do it this way.
Thanks in advance for any input!
could someone help me to merge these two queries together, I can't by myself.
Getting the Topics
Code: Select all
SELECT
t.*,
m.*,
UNIX_TIMESTAMP(t.topic_time) as 'timestamp'
FROM
topics AS t,
members AS m
WHERE
t.topic_uid = m.member_idCode: Select all
SELECT *, MAX(post_time) AS newest FROM posts GROUP BY post_tidThanks in advance for any input!