• WPChina

    (@wordpresschina)


    I’m using the following SQL code query to return a chart of the posts published each day:

    select
    count(*) as total_posts ,
    date(post_date) as posted_date
    from wp_posts
    group by posted_date
    having total_posts > 0

    However, it returns a chart with a flat line. The WordPress installation has about 11,000 posts over a 10 year period, and the line should not be flat since some days there are zero posts and some days there are 20 posts. What am I doing wrong in the sql query?

    https://www.ads-software.com/plugins/wp-business-intelligence-lite/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, when you test the query do you get a correct result? You should see the result in a table with the first 20 elements.

    Thread Starter WPChina

    (@wordpresschina)

    Yes that’s why it’s odd that it’s not displaying the chart correctly. Weird.

    When displaying the chart do you get any error message in the JS console? (shift+ctrl+I)

    Thread Starter WPChina

    (@wordpresschina)

    Hi yes in Chrome I see this error in JS Console for nv.d3.min.js:1 (total 894). What else should I look at for troubleshooting?

    I think there might be a problem with the data format. You can have a look at the page source (ctrl+U) and see the json file with the data series.
    You can as well reduce the time span just to see if it works with less data and then you increase it little by little.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘SQL query appears incorrect?’ is closed to new replies.