SQL help requested
L.S.
Could anyone help me with my SQL query? The tables I need for my query:
tblUser
-------
u_id
u_nickname
[...]
tblTopicComment
---------------
tc_id
tc_topicId
tc_userId
tc_contentbody
tc_insertdate
[...]
I want to select:
a) the most recent comments on a specific topic AND
b) from different users
I now use:
SELECT tc_contentbody, UNIX_TIMESTAMP(tc_insertdate), u_nickname FROM tblTopicComment INNER JOIN tblUser on (tc_userId = u_id)
GROUP BY tc_userId
ORDER BY tc_insertdate DESC LIMIT 3
This query doesn't seem to grab the most recent comments. I've also tried using the DISTINCT, but that didn't work for me either.
Any suggestions?
Thanks in advance,
MvO
|