A post have many comments,
I want to select only posts wich have comments with a certain id (ex: (2, 4, 6, 7))
I tried the following sql query:
SELECT wp_posts.* FROM wp_posts
LEFT JOIN wp_comments ON wp_comments.comment_ID IN (2, 4, 6, 7);
The query return me weird results.
Can someone tell ma what wrong with this query ? thanks in advance
Try this:
Modify the names of the columns for post_id in
ON C.post_ID = P.post_IDas required; I’m not sure of the WordPress exact column names.