mardi 19 juillet 2016

Selecting rows where phrase is in different columns

I've tried finding an answer to this, but I've had no luck.

I want to select all rows that contain a string $search in at least one column.

This is my SQL query right now: SELECT * FROM catalog WHERE name LIKE '%$search%'

I'd like to search some of the other columns (brand, model, category, subcategory, stock, year) as well as the name column. Is there any way I can search all of these columns in one SQL query?

Aucun commentaire:

Enregistrer un commentaire