SELECT wp_posts.* FROM wp_posts LEFT JOIN wp_postmeta ON  (  wp_posts.ID  =  wp_postmeta.post_id AND wp_postmeta.meta_key  =  'fave_agent_visible'  )  LEFT JOIN wp_postmeta AS mt1 ON  (  wp_posts.ID  =  mt1.post_id  )  WHERE 1 = 1 AND wp_posts.ID NOT IN  ( 28313,28341 )  AND  (  wp_postmeta.post_id IS NULL OR  (  mt1.meta_key  =  'fave_agent_visible' AND CAST ( mt1.meta_value AS SIGNED )  ! =  '1'  )   )  AND wp_posts.post_type  =  'houzez_agent' AND   (  (  wp_posts.post_status  =  'publish'  )  )   GROUP BY wp_posts.ID ORDER BY wp_posts.post_title ASC