Title: custom select query
Last modified: August 19, 2016

---

# custom select query

 *  [vinpkl](https://wordpress.org/support/users/vinpkl/)
 * (@vinpkl)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/custom-select-query-2/)
 * i was googling around and found this code for custom query
 * [http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query](http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query)
 *     ```
       $querystr = "
           SELECT wposts.*
           FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
           WHERE wposts.ID = wpostmeta.post_id
           AND wpostmeta.meta_key = 'tag'
           AND wpostmeta.meta_value = 'email'
           AND wposts.post_status = 'publish'
           AND wposts.post_type = 'post'
           ORDER BY wposts.post_date DESC
        ";
   
        $pageposts = $wpdb->get_results($querystr, OBJECT);
       ```
   
 * so my question is if i m not using custom fields then which code will work.
 * i want to do fetch data with custom query without using custom fields.
 * vineet

The topic ‘custom select query’ is closed to new replies.

## Tags

 * [custom-query](https://wordpress.org/support/topic-tag/custom-query/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [vinpkl](https://wordpress.org/support/users/vinpkl/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/custom-select-query-2/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
