• Resolved deko

    (@deko)


    Basic SQL question:

    A. $qryPosts = "select count(*) -1 as ct from wp_posts where post_status = 'publish';

    B. $qryPosts = "select count(*) -1 as ct from wp_posts where post_status = 0;

    I’ve tried both, but no luck.

    Looking at the table structure of wp_posts, I see this:

    FIELD | TYPE
    post_status | enum | (‘publish’, ‘draft’, ‘private’, ‘static’, ‘object’, ‘attachment’)

    I assume the enum is zero-based (?)

    Why do neither of my queries work correctly?

    How do I select a count of only published posts?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to select only published posts?’ is closed to new replies.