I'm your MySQL database.

I've added a custom area to some Wordpress database known as "short_url"

I would like a listing of posts within the database together with the worthiness for "short_url" when the publish has that value. However I want all the posts nevertheless. I've composed the next query and used a LEFT join to ensure that I recieve back all posts even when there's no corresponding custom value, but it's no longer working.

SELECT
    wp_posts.post_title
    , wp_posts.post_date
    , wp_postmeta.meta_value
FROM
    wp_posts
    LEFT JOIN wp_postmeta
        ON ( wp_posts.ID = wp_postmeta.post_id)
WHERE (wp_postmeta.meta_key ="short url");

This question returns 12 results, that is the number of articles possess the custom value, but you will find 193 posts during my database.

Why I get back is a listing of just posts which have the "short_url" value?

How do i obtain a full list?

You have to slowly move the condition in the WHERE clause towards the ON clause. Conditions inside a WHERE clause affect all the results. Conditions within the ON clause modify the JOIN.

SELECT
    wp_posts.post_title,
    wp_posts.post_date,
    wp_postmeta.meta_value
FROM
    wp_posts
    LEFT JOIN wp_postmeta
        ON (wp_posts.ID = wp_postmeta.post_id) AND
           (wp_postmeta.meta_key ="short url");