UPDATE I will debug my question and re-post it with more elaboration! I apologize for the confusion!
UPDATE Everyone who commented or posted an answer i will link you to my re-posting, thank you for taking the time to check my question and comment/answer!
I will make my question simple and straight to the point; The block of code below generates a syntax error when i include the first three subqueries.
What am i doing wrong?
SELECT
parent1.parent1_id,
parent1.child1_id,
parent1.child2_id,
parent1.child3_id,
parent2.parent2_id,
parent2.child1_id,
parent2.child2_id,
parent2.child3_id
FROM
parent1
LEFT JOIN
( SELECT
child1.child1_id,
child1.child1_content
FROM
child1
WHERE
child1.child1_id = parent1.child1_id ) child1
( SELECT
child1_extras.child1_extrasID,
child1_extras.child1_extrasContent
FROM
child1_extras
WHERE
child1_extras.child1_id = child1.child1_id )
ON parent1.child1_id = child1.child1_id
LEFT JOIN child2
( SELECT
child2.child2_id,
child2.child2_content
FROM
child2
WHERE
child2.child2_id = parent1.child2_id )
( SELECT
child2_extras.child2_extrasID,
child2_extras.child2_extrasContent
FROM
child2_extras
WHERE
child2_extras.child2_id = child2.child2_id )
ON parent1.child2_id = child2.child2_id
LEFT JOIN child3
( SELECT
child3.child3_id,
child3.child3_content
FROM
child3
WHERE
child3.child3_id = parent1.child3_id )
( SELECT
child3_extras.child3_extrasID,
child3_extras.child3_extrasContent
FROM
( SELECT
comments.comment_id,
comments.comment
FROM
comments
WHERE
comments.child3_extrasID = child3_extras.child3_extrasID ) child3_extras
JOIN child3
ON child3_extras.child3_id = child3.child3_id )
ON parent1.child3_id = child3.child3_id
LEFT JOIN followers
ON parent1.user_id = followers.followed_id
AND parent1.parent1_timestamp > followers.follower_timestamp
AND parent1.parent1_id NOT IN ( SELECT removed.isub_rmv FROM removed )
AND parent1.parent1_hide = false
WHERE
followers.follower_id = {$_SESSION['info']}
{$portname_clause}
ORDER BY
parent1.parent1_timestamp DESC
LIMIT {$postnumbers}
OFFSET
{$offset}
Many thanks in advance.
See Question&Answers more detail:os