Select returns the right results but I am unable to delete records by below query. Any help much appreciated:
delete wp_posts_cpy,wp_postmeta_cpy from (select * from wp_postmeta_cpy meta inner join wp_posts_cpy p ON(meta.post_id=p.id) where p.post_type='co-listing' and meta.meta_key='agent_id') p left join wp_posts_cpy agent ON(p.meta_value=agent.id) where
agent.post_title IS NULL
DELETE wp_posts_cpy
, wp_postmeta_cpy
FROM wp_postmeta_cpy meta
INNER
JOIN wp_posts_cpy p
ON p.id = meta.post_id
AND p.post_type = 'co-listing'
LEFT
JOIN wp_posts_cpy agent
ON agent.id = p.meta_value
WHERE meta.meta_key = 'agent_id'
AND agent.post_title IS NULL
if further issues, try removing all the table aliases