Results 1 to 1 of 1

Thread: [SQL] Show ads from the parent category

  1. #1
    Thread Starter
    Newbie taradict's Avatar
    Join Date
    Mar 2014
    Location
    France
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [SQL] Show ads from the parent category

    Hi,

    This is my SQL below... I have specific ads (paid ads with cp_pack_id=3 ) but how can i have only the ads from the parent category?

    SELECT DISTINCT *
    FROM $wpdb->posts, $wpdb->postmeta, $table_name AS t
    WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
    AND t.postnum = $wpdb->posts.ID
    AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = '$post_type'
    AND $wpdb->postmeta.meta_key = 'cp_pack_id'
    AND $wpdb->postmeta.meta_value = '3'
    GROUP BY $wpdb->posts.ID
    ORDER BY t.postcount DESC LIMIT $limit


    many thanks for your help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [MOD NEEDED] Show Parent Category and sub category in Step1
    By rlawrie in forum ClassiPress General Discussion
    Replies: 2
    Last Post: August 23rd, 2013, 08:35 AM
  2. Only show main / parent category
    By vhabui in forum MapPress
    Replies: 1
    Last Post: February 25th, 2013, 10:27 PM
  3. Show Parent Category in step1
    By 100d in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: August 25th, 2012, 09:02 PM
  4. Getting the Category to show the current in the searchbar dropdown.
    By lawrenceb in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: March 8th, 2011, 08:48 AM
  5. Show parent category in index, search result and category
    By setempat in forum ClassiPress General Discussion
    Replies: 1
    Last Post: January 7th, 2011, 04:02 AM