Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter lee_k

    (@lee_k)

    Otto

    I found this which solves the problem for me. But it doesn’t help for producing a plugin that can be used by the community.

    Guess I’ll have to keep on looking.

    Lee

    Thread Starter lee_k

    (@lee_k)

    Otto

    The YOUR* bits have been changed and the error doesn’t give much information. Here is it below.

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4]
    SELECT COUNT(DISTINCT ID) FROM wp_posts LEFT JOIN (SELECT post_id, count(*) user_count FROM wp_postmeta WHERE meta_key = 'votes'

    Like I said, the query does work as the posts are displayed in the order I was after. This error message appears after the posts details.

    Initially I was thinking that the ‘trouble’ was the subquery but I am running MySQL 4.1.11 (I understand that subqueries feature from 4.1 onwards).

    Cheers
    Lee

    Thread Starter lee_k

    (@lee_k)

    Otto
    Your solution mostly worked. It shows the posts ordered by the count of user_ids in the wp-postmeta table, which is what I was after. However, strangely it also displays an SQL error at the end for the part –
    “(SELECT post_id, count(*) YOUR_COUNT_NAME FROM $wpdb->postmeta”

    David
    I want the count of user-ID’s per post. I know basic MySQL and not really sure what subqueries are. But I am thinking it is related to the part of the query that is getting the error message above.

    Thanks for your help guys

    Thread Starter lee_k

    (@lee_k)

    Thanks for the reply.

    Can you point any examples of this so I can see how the code looks.

    Cheers
    Lee

    I’m after a way to do something similar.

    I want to add an extra variable to the category urls when a plugin is called. ‘list_cats’ seems the closest filter, but that only accesses the category names, not urls.

    Can anyone help?

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