Title: SQL Query needed!!
Last modified: September 1, 2016

---

# SQL Query needed!!

 *  Resolved [pankaj1997](https://wordpress.org/support/users/pankaj1997/)
 * (@pankaj1997)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/sql-query-needed/)
 * Hello! Please give me the SQL query through which RSVPmaker selects all the upcoming
   events from the database? Please, it’s urgent!
 * [https://wordpress.org/plugins/rsvpmaker/](https://wordpress.org/plugins/rsvpmaker/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [davidfcarr](https://wordpress.org/support/users/davidfcarr/)
 * (@davidfcarr)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/sql-query-needed/#post-7535392)
 * A typical query associated with the rsvpmaker_upcoming shortcode would be something
   like
 * SELECT wpb_posts.*, meta_value as datetime, meta_id FROM wpb_posts JOIN wpb_postmeta
   ON wpb_postmeta.post_id = wpb_posts.ID AND meta_key=’_rsvp_dates’ WHERE 1=1 AND
   wpb_posts.post_type = ‘rsvpmaker’ AND ((wpb_posts.post_status = ‘publish’)) AND
   meta_value > CURDATE() AND meta_value < DATE_ADD( CURDATE() , INTERVAL 5 WEEK)
   ORDER BY meta_value
 * The specifics may vary depending on the options you have set. The query is pieced
   together using a series of filters on the standard WordPress query for posts.
 * What’s the big emergency where you need to know this?
 *  Plugin Author [davidfcarr](https://wordpress.org/support/users/davidfcarr/)
 * (@davidfcarr)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/sql-query-needed/#post-7535393)
 * The version I posted above is actually used by the calendar grid display. Here
   is an rsvpmaker_upcoming query
 * SELECT SQL_CALC_FOUND_ROWS DISTINCT wpb_posts.*, meta_value as datetime, meta_id
   FROM wpb_posts JOIN wpb_postmeta ON wpb_postmeta.post_id = wpb_posts.ID AND meta_key
   =’_rsvp_dates’ WHERE 1=1 AND wpb_posts.post_type = ‘rsvpmaker’ AND ((wpb_posts.
   post_status = ‘publish’)) AND meta_key=’_rsvp_dates’ AND meta_value > CURDATE()
   AND meta_value < DATE_ADD(CURDATE( ),INTERVAL 30 DAY) GROUP BY wpb_posts.ID ORDER
   BY meta_value LIMIT 0, 10
 * If I navigate ahead to next month, using the links at the bottom of the calendar
   widget, I get this:
 * SELECT SQL_CALC_FOUND_ROWS DISTINCT wpb_posts.*, meta_value as datetime, meta_id
   FROM wpb_posts JOIN wpb_postmeta ON wpb_postmeta.post_id = wpb_posts.ID AND meta_key
   =’_rsvp_dates’ WHERE 1=1 AND wpb_posts.post_type = ‘rsvpmaker’ AND ((wpb_posts.
   post_status = ‘publish’)) AND meta_key=’_rsvp_dates’ AND meta_value >= ‘2016-
   08-01’ AND meta_value < DATE_ADD(‘2016-08-01’,INTERVAL 30 DAY) GROUP BY wpb_posts.
   ID ORDER BY meta_value LIMIT 0, 10

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL Query needed!!’ is closed to new replies.

 * ![](https://ps.w.org/rsvpmaker/assets/icon-128x128.png?rev=1050978)
 * [RSVPMaker](https://wordpress.org/plugins/rsvpmaker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rsvpmaker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rsvpmaker/)
 * [Active Topics](https://wordpress.org/support/plugin/rsvpmaker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rsvpmaker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rsvpmaker/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [davidfcarr](https://wordpress.org/support/users/davidfcarr/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/sql-query-needed/#post-7535393)
 * Status: resolved