Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2015
    Posts
    1

    Unanswered: If any can give help in the following query?

    Dear friends
    If any can give help in the following query:

    I have the following query:
    SELECT wp_posts.post_date, wp_posts.post_title, wp_postmeta.meta_value
    FROM wp_posts
    INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
    WHERE wp_posts.post_type = 'anuncio'
    AND wp_posts.post_status = 'publish'
    AND wp_postmeta.meta_key = '_company_id'

    LIST:
    -------------------------
    DATA 1 - TIT1 - 1
    DATA 2 - TIT2 - 1
    DATA 3 - TIT3 - 1
    DATA 4 - TIT4 - 2
    DATA 5 - TIT5 - 2
    DATA 6 - TIT6 - 2
    DATA 7 - TIT7 - 2
    DATA 8 - TIT8 - 3
    DATA 9 - TIT9 - 3

    I need the result to be this:
    --------------------------
    DATA 1 - TIT1 - 1
    DATA 2 - TIT2 - 1
    DATA 4 - TIT4 - 2
    DATA 5 - TIT5 - 2
    DATA 8 - TIT8 - 3
    DATA 9 - TIT9 - 3

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Mebbe im being thick here, but how do you expect to eliminate the 2 rows not in the required result. On the face of it there is no rhyme no reason behind the rows included or excluded, nor any explicit reason behind the sort ORDER.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    add the clause
    Code:
    and wp_posts.post_title not in ('TIT3','TIT6,'TIT7')
    Dave

  4. #4
    Join Date
    Oct 2015
    Location
    Chennai
    Posts
    1
    does this resolve your issue, if it is not resolved yet then please post sample table schema it will help to further digg into this issue.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •