Advertisement
kcsweb

wp-event-organiser

Jan 20th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.99 KB | None | 0 0
  1. SELECT SQL_CALC_FOUND_ROWS
  2.     wpiw_posts.*,
  3.     wpiw_eo_events.event_id,
  4.     wpiw_eo_events.event_id AS occurrence_id,
  5.     wpiw_eo_events.StartDate,
  6.     wpiw_eo_events.StartTime,
  7.     wpiw_eo_events.EndDate,
  8.     wpiw_eo_events.FinishTime,
  9.     wpiw_eo_events.event_occurrence
  10. FROM wpiw_posts
  11. LEFT JOIN wpiw_eo_events
  12. ON wpiw_posts.ID = wpiw_eo_events.post_id
  13. INNER JOIN (
  14.     SELECT wpiw_eo_events.event_id
  15.     FROM wpiw_eo_events
  16.     WHERE (
  17.         wpiw_eo_events.EndDate > '2018-01-20'
  18.         OR (
  19.             wpiw_eo_events.EndDate = '2018-01-20'
  20.             AND wpiw_eo_events.FinishTime > '12:41:35'
  21.         )
  22.     )
  23.     ORDER BY wpiw_eo_events.StartDate ASC,
  24.     wpiw_eo_events.StartTime ASC
  25. )  AS eoid
  26. ON eoid.event_id = wpiw_eo_events.event_id
  27. WHERE 1=1
  28. AND wpiw_posts.post_type = 'event'
  29. AND (
  30.     wpiw_posts.post_status = 'publish'
  31.     OR wpiw_posts.post_status = 'confirmed'
  32.     OR wpiw_posts.post_status = 'private'
  33. )
  34. GROUP BY wpiw_posts.ID
  35. ORDER BY wpiw_eo_events.StartDate ASC,
  36. wpiw_eo_events.StartTime ASC
  37. LIMIT 7, 7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement