Avoid duplicate foreign_key values when do eager loading (preloading)

Example:

    $posts = Post::all(array('include' => array('author'));

    foreach($posts as $post){
        echo $post->author->name;
    }

After loading the posts, It will collect the *author_id* from each one and load all the referenced authors with one query.

But some posts may have the same *author_id* so we should avoid them being duplicated (in select query).