hothousegraphix
11-17-2007, 05:29 AM
I'm performing a query to pull in data for a page on which I display my sites members in descending order by the date each user established their site membership. Each member listing displays the users *latest* comment contribution along with the comment date and the title of article entry the comment was made to.
I'm pulling info from 3 tables: exp_members, exp_comments, and exp_weblog_titles.
The query I have below works with one glitch:
SELECT member_id, screen_name AS s_name, avatar_filename,
comment, title, t.entry_id, url_title
FROM exp_members m
LEFT JOIN exp_comments c
ON m.member_id = c.author_id
LEFT JOIN exp_weblog_titles t
ON c.entry_id = t.entry_id
GROUP BY member_id
ORDER BY join_date, comment_date DESC LIMIT 50
All the data is pulled and displayed by each member in descending order based on the date each user joined. The comments are displayed as well as the article info associated with it.
The trouble is that the comments pulled are not the users *latest* comment. They are the users *First* comment made to the site.
It seems that ORDER BY comment_date DESCis not being recognized.
Would anyone have a clue as to how to get the LATEST comment for each user in this situation.
(Please be gentle, this is not my area of expertise)
Thanks in advance.
I'm pulling info from 3 tables: exp_members, exp_comments, and exp_weblog_titles.
The query I have below works with one glitch:
SELECT member_id, screen_name AS s_name, avatar_filename,
comment, title, t.entry_id, url_title
FROM exp_members m
LEFT JOIN exp_comments c
ON m.member_id = c.author_id
LEFT JOIN exp_weblog_titles t
ON c.entry_id = t.entry_id
GROUP BY member_id
ORDER BY join_date, comment_date DESC LIMIT 50
All the data is pulled and displayed by each member in descending order based on the date each user joined. The comments are displayed as well as the article info associated with it.
The trouble is that the comments pulled are not the users *latest* comment. They are the users *First* comment made to the site.
It seems that ORDER BY comment_date DESCis not being recognized.
Would anyone have a clue as to how to get the LATEST comment for each user in this situation.
(Please be gentle, this is not my area of expertise)
Thanks in advance.