I'm trying to make a mysql query which select all the posts from wp_posts and select the post_title and post_content from it and then select the table wp_postmeta and show the meta_value where meta_key is equal with "_wp_attached_file".
I've tried doing this:
SELECT post_title, post_content, meta_value FROM wp_posts, wp_postmeta WHERE ID = post_id and meta_key = '_wp_attached_file'
But this will only show if there is a meta_key equal to '_wp_attached_file'.
The query should show all posts and if it has a meta_key equal to '_wp_attached_file'. Then show meta_value else just show nothing or NULL?
How can i do this?