All I wanted was the parent comment!

Feb 02, 2007 17:34



Okay, this is supposed to be how you get a parent comment:

SELECT
child.*,

parent_comment.*,
parent_user.*,
parent_userset.*,
parent_blog.*,
parent_object.*,
parent_objectset.*,

comment_comment.*,
comment_blog.*,
comment_user.*,
comment_userset.*,
comment_object.*,
comment_objectset.*,

user_comment.*,
user_blog.*,
user_user.*,
user_userset.*,
user_object.*,
user_objectset.*

FROM user_comment_comment AS child

JOIN user_comment_comment AS parent_comment ON child.oncommentid = parent_comment.commentid
JOIN user_comment_blog AS parent_blog ON child.oncommentid = parent_blog.commentid
JOIN user_comment_user AS parent_user ON child.oncommentid = parent_user.commentid
JOIN user_comment_userset AS parent_userset ON child.oncommentid = parent_user.commentid
JOIN user_comment_object AS parent_object ON child.oncommentid = parent_object.commentid
JOIN user_comment_objectset AS parent_objectset ON child.oncommentid = parent_objectset.commentid

JOIN comment AS comment_comment ON comment_comment.commentid = parent_comment.commentid
JOIN comment AS comment_blog ON comment_blog.commentid = parent_blog.commentid
JOIN comment AS comment_user ON comment_user.commentid = parent_user.commentid
JOIN comment AS comment_userset ON comment_userset.commentid = parent_userset.commentid
JOIN comment AS comment_object ON comment_object.commentid = parent_object.commentid
JOIN comment AS comment_objectset ON comment_objectset.commentid = parent_objectset.commentid

JOIN user AS user_comment ON user_comment.userid = parent_comment.userid
JOIN user AS user_blog ON user_blog.userid = parent_blog.userid
JOIN user AS user_user ON user_user.userid = parent_user.userid
JOIN user AS user_userset ON user_userset.userid = parent_userset.userid
JOIN user AS user_object ON user_object.userid = parent_object.userid
JOIN user AS user_objectset ON user_objectset.userid = parent_objectset.userid

WHERE child.commentid='$fromcommentid'
... and it doesn't work anyway! Bollocks to it, the comments structure is going down.

Previous post Next post
Up