Need Help with Complicated WHERE Clause

Discussion in 'Databases' started by Masterful, Sep 14, 2008.

  1. #1
    Here's my SELECT statement:

    SELECT
    
    adv,
    advlogo,
    advurl,
    
    cat,
    caturl,
    
    instr,
    blockanch,
    
    anch,
    gotourl,
    code,
    DATE_FORMAT(expdate, '%d %M, %Y') AS formated_date,
    
    expun
    
    FROM tadv, tcat, tinstr, tcoupon
    
    LEFT JOIN texpun on tcoupon.expunid=texpun.expunid
    
    WHERE 
    
    tcoupon.advid=tadv.advid AND
    tcoupon.catid=tcat.catid AND
    tcoupon.instrid=tinstr.instrid;
    Code (markup):
    I want to add the following but it doesn't work:

    AND type='a' || type='c';
    Code (markup):
    Funny thing is, it works without all the other WHERE clauses. For example:

    SELECT * from tcoupon WHERE type='a' || type='c';
    Code (markup):
    Anyone know how to do it?
     
    Masterful, Sep 14, 2008 IP
  2. Onera

    Onera Peon

    Messages:
    864
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How about

    where xxxx AND yyyy AND zzz AND (type='a' OR type = 'c')
     
    Onera, Sep 14, 2008 IP
    Masterful likes this.
  3. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Thanks, Onera! It worked.

    I added reputation points to your account. :)
     
    Masterful, Sep 14, 2008 IP