1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

SQL query to return all results except one catgory's

Discussion in 'MySQL' started by ftpaccess, Sep 27, 2017.

  1. #2
    I have this query

    SELECT p.product_id,
                    CONCAT(m.name,' ',p.model) as product_model,      
                    p.model,
                    p.price,
                    ocd.name AS category,
                    m.name AS brand,
                    CONCAT_WS('',CONCAT_WS('','http://www.sitename.com/index.php?route=product/product&modelnumber=',p.model),'&path=1&product_id=',p.product_id) AS productpageurl
                    FROM oc_product p
                    LEFT JOIN oc_manufacturer m ON m.manufacturer_id = p.manufacturer_id
                    LEFT JOIN oc_product_to_category pc ON pc.product_id = p.product_id
                    LEFT JOIN oc_product_description pd ON pd.product_id = p.product_id
                    LEFT JOIN oc_category_description ocd ON ocd.category_id = pc.category_id
                    LIMIT $index,10000
                    ";
    Code (markup):
    All i want is to do the same except not to output results of a category starting with BBQ. Not sure how to modify the above query for this. can anyone help?
     
    Last edited by a moderator: Sep 27, 2017
    ftpaccess, Sep 27, 2017 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #3
    add

    where ocd.name not like 'BBQ%'
    Code (markup):
     
    sarahk, Sep 27, 2017 IP