Title: WordPress SQL Select modification for getting posts by user
Last modified: August 19, 2016

---

# WordPress SQL Select modification for getting posts by user

 *  [bepresents](https://wordpress.org/support/users/bepresents/)
 * (@bepresents)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/wordpress-sql-select-modification-for-getting-posts-by-user/)
 * Hi,
 * I would like to get the WordPress SQL statement to select the 10 most recent 
   approved posts by user.
 * I have this statement which selects all the recent posts, but will duplicate 
   users if they posted more than 1.
 *     ```
       SELECT p.post_title, p.post_author, p.post_date, p.post_name, wpr.object_id, wp_1_terms.name, wp_1_terms.slug
       FROM wp_1_terms
       INNER JOIN wp_1_term_taxonomy ON wp_1_terms.term_id = wp_1_term_taxonomy.term_id
       INNER JOIN wp_1_term_relationships wpr ON wpr.term_taxonomy_id = wp_1_term_taxonomy.term_taxonomy_id
       INNER JOIN wp_1_posts p ON p.ID = wpr.object_id
       WHERE taxonomy = 'category'
       AND p.post_type = 'post'
       ORDER BY post_date DESC
       LIMIT 10
       ```
   

The topic ‘WordPress SQL Select modification for getting posts by user’ is closed
to new replies.

## Tags

 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [select](https://wordpress.org/support/topic-tag/select/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)
 * [users](https://wordpress.org/support/topic-tag/users/)

 * 0 replies
 * 1 participant
 * Last reply from: [bepresents](https://wordpress.org/support/users/bepresents/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/wordpress-sql-select-modification-for-getting-posts-by-user/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
