Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT p.post_title, p.post_parent, p.ID, p.post_name AS post_name, p.post_content, pm1.meta_value AS rate, pm_not_gay.meta_value AS not_gay, ci.title_en AS city, co.title_en AS country, pm5.meta_value AS stars, pm6.meta_value AS thumb_id, pm7.meta_value AS marker, wt.name AS term_name, wt.slug AS term_slug, wt.term_id as term_id, obd.meta_value AS date, location.meta_value as location
- FROM wp_term_relationships wtr JOIN wp_posts p
- ON p.ID = wtr.object_id
- LEFT JOIN wp_postmeta pm1
- ON pm1.post_id = p.ID
- AND pm1.meta_key = 'gaywee_rate' JOIN wp_postmeta pm_not_gay
- ON pm_not_gay.post_id = p.ID
- AND pm_not_gay.meta_key = 'gaywee_not_gay'
- LEFT JOIN wp_postmeta pm3
- ON pm3.post_id = p.ID
- AND pm3.meta_key = 'REAL_HOMES_city'
- LEFT JOIN wp_postmeta location
- ON location.meta_key = 'REAL_HOMES_property_location' and p.ID = location.post_id
- LEFT JOIN wp_postmeta pm5
- ON pm5.post_id = p.ID
- AND pm5.meta_key = 'REAL_HOMES_stars'
- LEFT JOIN wp_postmeta pm6
- ON pm6.post_id = p.ID
- AND pm6.meta_key = '_thumbnail_id'
- LEFT JOIN wp_postmeta pm7
- ON pm7.post_id = p.ID
- AND pm7.meta_key = 'REAL_HOMES_property_marker'
- LEFT JOIN wp_terms wt
- ON wtr.term_taxonomy_id = wt.term_id
- LEFT JOIN wp_postmeta obd
- ON obd.post_id = p.ID and obd.meta_key = 'object_date'
- LEFT JOIN wp_postmeta object_date
- ON object_date.post_id = p.ID
- AND object_date.meta_key = 'object_date' JOIN _cities ci
- ON ci.city_id = pm3.meta_value JOIN _countries co
- ON co.country_id = ci.country_id
- WHERE p.post_status = 'publish' and wtr.term_taxonomy_id IN (7019,7021,7023,7152,7420,7796,7877,8473) and object_date.meta_value >= '2017-11-20'
- GROUP BY p.ID
- ORDER BY object_date.meta_value ASC
- LIMIT 0, 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement