内部联接的mysql查询返回重复的条目

I tried this code in phpmysql

 SELECT p.ID, p.post_title, p.post_name
 FROM `wp6p_popularpostsdata` AS pps
     INNER JOIN `wp6p_posts` AS p ON pps.`postid`= p.`ID`
 WHERE p.post_type = "post"
     AND pps.last_viewed > DATE_SUB(CURDATE(), INTERVAL 1 WEEK)
 ORDER BY pps.`pageviews` DESC 
 LIMIT 4

and it gives the results properly

1336Reading Between The Lines. reading-between-the-lines
824 Benefits of Watching Anime benefits-of-watching-anime
1427 The Day Goes By. life-goes-by
1950 Click here if you want to be rich want-to-be-rich

But when I use it in my php file, it returns

READING BETWEEN THE LINES. READING BETWEEN THE LINES. THE DAY GOES BY. BENEFITS OF WATCHING ANIME

global $wpdb;
$interval = "1 WEEK";
$now = current_time('mysql');
$top4 = $wpdb->get_results(
'SELECT p.ID, p.post_title, p.post_name
 FROM `' . $wpdb->prefix . 'popularpostssummary` AS pps
     INNER JOIN `' . $wpdb->prefix . 'posts` AS p ON pps.`postid`= p.`ID`
 WHERE p.post_type = "post"
     AND pps.last_viewed > DATE_SUB("' . $now . '", INTERVAL ' . $interval . ')
 ORDER BY pps.`pageviews` DESC 
 LIMIT 4;', ARRAY_A
);
foreach( $top4 AS $index => $row ) {
$class = ( $index == ( count( $top4 ) - 1 ) ) ? ' last' : '';
$url = get_permalink( $row['ID'] );
echo '<li class="trendingPost'.$class.'">' . 
     '<a href="' . $url . '">'.$row['post_title'].'</a></li>';
}

How can I prevent the duplicate result?

It is tempting to use exists rather than a join:

SELECT p.ID, p.post_title, p.post_name
FROM wp6p_posts p 
WHERE p.post_type = 'post' AND
      EXISTS (SELECT 1
              FROM wp6p_popularpostsdata pps
              WHERE pps.postid = p.ID AND
                    pps.last_viewed > DATE_SUB(CURDATE(), INTERVAL 1 WEEK)
             );

However, this doesn't allow you to order by pageviews. Instead, use aggregation:

SELECT p.ID, p.post_title, p.post_name
FROM wp6p_popularpostsdata pps INNER JOIN 
     wp6p_posts p
     ON pps.postid = p.`ID`
WHERE p.post_type = 'post' AND
      pps.last_viewed > DATE_SUB(CURDATE(), INTERVAL 1 WEEK)
GROUP BY p.ID, p.post_title, p.post_name
ORDER BY MAX(pps.pageviews) DESC 
LIMIT 4;