Custom Select Query - Selecting the Year? (1 post)

  1. pixeljuggler2011
    Posted 4 years ago #

    I have this queary were I'm grabbing all post types of "news" in 2010, but it doesn't select the posts from that year. What am i doing wrong?

    $querystr = "
    	SELECT $wpdb->posts.*
        FROM $wpdb->posts, $wpdb->postmeta
        WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
        AND $wpdb->posts.post_status = 'publish'
        AND $wpdb->posts.post_type = 'news'
        AND year($wpdb->posts.post_date) = 2010,
    	ORDER BY $wpdb->posts.post_date DESC

    Taking this line out does grab the news posts, but really I want them from a particular year.
    AND year($wpdb->posts.post_date) = 2010,

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by pixeljuggler2011
  • This topic is not resolved
  • WordPress version: 3.2.1