-
Combining columns in the WHERE clause for searching
I'm writing a search engine for a site and have to check three different columns for the same search terms using AND/OR/NOT logic depending on the syntax of their search. I'm using LIKE for matching but I keep running into different logical traps. The easiest way to do this would be if I could combine the three columns into one and then search the combined column.
I know how to do this with an alias in the SELECT clause of the SQL statement. Is there a way to do it in the WHERE clause?
Something like:
SELECT * FROM TABLE_NAME WHERE (COLUMN1 + COLUMN2 + COLUMN3) LIKE '%search word%'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|