Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help with a sql query


  • grosbouff
    Participant

    @grosbouff

    Hi guys; I have a question about a query I made to select the items in my classifieds component.

    Here’s an example

    SELECT DISTINCT c.id AS classified3_id FROM wp_bp_classified3s c INNER JOIN wp_bp_classified3s_classified3meta cm ON cm.classified3_id = classified3_id INNER JOIN wp_usermeta um ON um.user_id = c.creator_id WHERE c.status = 'published'

    First; do you think my query is OK ?

    I have some problems understanding JOIN; so if you have things to correct in it, please tell !

    Then, and this is why I’m writing here;

    I would like to filter my query to exclude the items where the author (c.creator_id) is banned.

    We can check if he is banned in the wp_usermeta table :

    a user banned will have a usermeta key where meta_key=’classified3s_banned’.

    Big thanks for help !

  • The topic ‘Help with a sql query’ is closed to new replies.
Skip to toolbar