Several columns in the WHERE clause

In the following query I would like to search for more than name, for example: WHERE name brand size LIKE ‘%q%’
but, I don’t know the correct syntax to follow.

SELECT *
FROM (
          SELECT *
          FROM `products`
          WHERE `name`
          LIKE '%q%'
          AND `user_id` = '$user_id'
      )
          AS results
WHERE    `status` = 0
OR       `status` = 1
OR       `status` = 2
OR       `status` = 3

I need help

If I understand you, this should get you what you want (or at least push you in the right direction)…


SELECT *
  FROM `products`
 WHERE (`name` LIKE '%q%' OR `brand` LIKE '%q%' OR `size` LIKE '%q%')
   AND `user_id` = '$user_id'
   AND `status` IN (0, 1, 2, 3)

It’s so much simpler, and it worked great. Thanks so much.