| 4 | |
| 5 | Update 2: Here is one of the query that seem to be the problem, I think the problem is related to the |
| 6 | AND meta_value IN ('Distillery','Bottling') |
| 7 | |
| 8 | SELECT wp_posts.* FROM wp_posts JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') AND wp_posts.ID IN ( |
| 9 | SELECT post_id |
| 10 | FROM wp_postmeta |
| 11 | WHERE meta_key = 'bottler' |
| 12 | AND meta_value IN ('Distillery','Bottling') |
| 13 | GROUP BY post_id |
| 14 | HAVING COUNT(*) >= 2 |
| 15 | ) GROUP BY wp_posts.ID HAVING COUNT(*) = 1 ORDER BY wp_posts.post_date DESC LIMIT 40, 10 |