MySQL syntax

Discussion in 'Programming/Scripts' started by edge, Jul 20, 2007.

  1. edge

    edge Active Member Moderator

    Anyone here who could show me what I'm doing wrong here?
    The syntax is working, but it's showing thing that it found (with red in it) in not only categoryID 1, but also categoryID 11.

    I want it to only show stuff found from (in this case categoryID 1)
  2. edge

    edge Active Member Moderator

    Ok.. got it working after a bit more thinking...

    It needed an other `categoryID` = '1' for the 2nd like :/

  3. falko

    falko Super Moderator ISPConfig Developer

    You can also use brackets like this:

    SELECT * FROM product where `categoryID` = '1' and (`remarks` like '%red%' or `productNAME` like '%red%') order by productID DESC
  4. edge

    edge Active Member Moderator

    That does look less confusing to me.

    From now I'll be using the MySQL syntax like that.

    Thank you

Share This Page