On a side note: I was probably wrong mentioning PDO, it’s most probably a difference at a lower level.
Edit:
I think it’s clear that this is at least not at all Yii related.
Since I’m not an DB expert, my suggestion - if RIGHT JOIN doesn’t help - is that you rearrange, or probably even better, break apart the JOIN operations for better control. You didn’t mention which DB you use. Here’s a link to the mySQL manual:
I dont know why but your suggestion of separating joins worked:
my query now looks like:
$paginated = "SELECT l.ID FROM NODE n
JOIN NODE_LEAF nl ON n.ID = nl.NODE_ID
JOIN LEAF l ON l.ID = nl.LEAF_ID
JOIN EXTRA_LEAF e ON e.LEAF_ID = l.ID
JOIN LEAF_RESOURCE lr ON lr.LEAF_ID = l.ID
JOIN EXTRA_NODE en ON en.NODE_ID = n.ID
WHERE en.NODE_ID IN (SELECT id FROM Node WHERE node_id = {$this->id})
ORDER BY l.PUBLICATION_START_DATE DESC LIMIT $offset, $limit;"