Try this for posts from last 1 year:
AND (
post_date_gmt < DATE(NOW()-INTERVAL 1 YEAR)
)
Related Posts:
- Inserting Post Meta From SQL
- How to execute mulitple statement SQL queries using $wpdb->query?
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Query WordPress database by registered date and role
- Size article thumbnails and retrieve them directly from database
- wpdb_prepare with multiple or condition
- SQL Error wp_commentmeta – incorrect table definition
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- Create table from array with prepare
- Why this query is not showing any result on wordpresss home page?
- Why does changing Database Table Prefixes result in loss of content?
- SQL query to set posts in bulk based on the post content
- $wpdb->get_var – What value is returned when zero records are found?
- DB prefix not updating
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- How to create index (sql) to a meta_key?
- Delete all users meta that named: user_avatar
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- export individual posts to text files or a single csv file
- SQL query : Select a thumbnail for a media
- why you don’t Implement PDO for access every thing to database
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- What is “Advanced” SQL?
- MySQL SELECT increment counter
- Creating a search form in PHP to search a database?
- MySQL equivalent of DECODE function in Oracle
- MySQL Database User: Which Privileges are needed?
- Will it break my site if I delete all transient records in wp_options table?
- Please explain how WordPress works with MySQL character set and collation at a low level
- Restoring WordPress posts from database only
- WordPress database scalability from the code perspective
- Where are image paths to product category images stored in WordPress database
- Getting wrong relationship value in $args in wp_Query?
- Sharing database for collaborative development
- Can I use MariaDB instead of MySQL in wordpress?
- Using Dynamic Data Pulled from a MySQL Table in a WordPress Page
- What are conventions about the schema of the $table_prefix
- Split WP install between 2 databases?
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- Why does dbDelta() not catch MysqlErrors?
- Moving an entire wordpress site from one domain to a new domain and database
- Is deleting orphaned wp_options entries safe?
- Is altering a default WordPress database table update safe?
- How to solve slow WordPress site caused by attachment_metadata
- Delete all post meta except featured image
- Custom DB_COLLATE (collation) value not working on fresh install?
- What causes the “max_user_connections” warning on WordPress frontend?
- what to do when your WordPress database is too large?
- Change all http to https in mysql databse?
- Large database causes slow load
- Database slowdown after update to 3.4.1
- How to insert data into MySQL database from the form created in WordPress site
- WordPress site uses MyISAM, should I switch to InnoDB necessary?
- Which is more efficient? Using usermeta, or creating a new MySQL table?
- Uppercase to sentence case for post titles
- WordPress mysql table double prefixes
- Handling large N data in WordPress
- How to Mirror WordPress database from Remote server to Local server
- WordPress is not creating table in database after activating plugin,
- Is MariaDB’s Aria storage engine suitable for WordPress?
- Difficulty importing my live site to local
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- A MySQL DB within a MySQL DB
- How do I query wp_options for expired transient pairs with MySQL commands?
- Is there a way to recover the table wp_term_relationships?
- Trouble Migrating all data blog from WordPress.com to WordPress.org
- WordPress running SQL query to update database from form
- How to fix database error duplicate entry
- How do I convert a MySQL database from utf8mb4 to utf8 encoding?
- WPDB SQL query with prepare() returning variable, not db value
- Query multiple tables at once?
- Problems with moving my WordPress site to another domain/server
- Best practice to limit results in get_row()?
- How to migrate a database from a server to another
- Trouble running $wpdb->query() with last_insert_id
- how to encyrpt DB_PASSWORD in wp-config
- Delete all posts that do NOT have a specific tag
- Moving WordPress site to new domain – database import [duplicate]
- Location of WP default mySQL tables creation file?
- How to display data from db in select list [closed]
- How can I find user role in Mysql?
- Bulk find & replace on WordPress posts/pages (minus image paths)
- I would like some help wth an SQL query to link posts with categories
- How do I loop/iterate through posts to edit all img tags?
- Featured image from custom to WordPress database
- WordPress Database Query works in phpMyAdmin but not in the code
- Correct and secure way to access a custom SQL database in a custom PHP template file
- How to retrieve user data based on role using SQL?
- spambot registering without providing email or password, bypassing registration process
- Possible to restore wordpress database from mysql56 and sqlite files?
- Missing latest posts and options after DB migration via phpMyAdmin
- Widgets with *internal* links do not display after database migration
- How do i get value from wp_postmeta?
- “MySQL server has gone away” since update to 3.8
- featured image not showing up with mysql_connect
- Getting deleted users in database
- Print output of Table Creation
- Importing Concrete5 content to WordPress
- Uploading to WordPress Database