I have a MySQL query that selects content created by friends of the current user and lists that content in reverse chronological order.
SELECT node.nid AS nid,
node.created AS node_created
FROM node node
LEFT JOIN user_relationships user_relationships ON node.uid = user_relationships.requestee_id
LEFT JOIN users users_user_relationships ON user_relationships.requestee_id = users_user_relationships.uid
WHERE (node.status <> 0) AND (node.type in ('drigg', 'blog_post')) AND (user_relationships.requester_id = 1)
ORDER BY node_created DESC
How do I "expand" this query so it lists comments in addition to nodes?
here's the structure of the comment table:
- cid (comment ID)
- uid (ID of user who posted comment)
- timestamp (uses same UNIX date format as the "node created" column from the node table up above)
So right now the query grabs all the "nodes" written by people who are buddies with the current user. I want it to also grab all the comments written by people who are buddies with the current user. Then I want to list these nodes and comments in DESC order based on the date they were created.
It appears I need to add more stuff to my select statement, but I'm not sure what.