Advertisement
tareq1988

Untitled

Nov 13th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.19 KB | None | 0 0
  1. SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_2_posts.* FROM wp_2_posts
  2. LEFT JOIN wp_2_term_relationships AS trel ON (wp_2_posts.ID = trel.object_id)
  3. LEFT JOIN wp_2_term_taxonomy AS ttax ON ( ( ttax.taxonomy = 'category' OR ttax.taxonomy = 'post_tag' OR ttax.taxonomy = 'post_format' ) AND trel.term_taxonomy_id = ttax.term_taxonomy_id)
  4. LEFT JOIN wp_2_terms AS tter ON (ttax.term_id = tter.term_id)
  5. LEFT JOIN wp_2_postmeta AS m ON (wp_2_posts.ID = m.post_id)
  6. WHERE 1=1 AND
  7.     wp_2_posts.post_type='event' AND
  8.     wp_2_posts.ID in (
  9.         select p.ID from wp_2_posts p where p.post_type='event' and p.ID in (
  10.             select pm.post_id from wp_2_postmeta pm
  11.             where
  12.                 pm.meta_key like 'st_date' and
  13.                 pm.meta_value <= "2011-11-13" and
  14.                 pm.post_id in (
  15.                     (select pm.post_id from wp_2_postmeta pm
  16.                         where
  17.                             pm.meta_key like 'end_date' and
  18.                             pm.meta_value>="2011-11-13"
  19.                     )
  20.                 )
  21.             )
  22.         )
  23.     and wp_2_posts.post_status in ('publish','private')
  24.    
  25. ORDER BY wp_2_posts.post_date
  26. DESC LIMIT 0, 6
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement