add multiple column condition in one where clause

Viewed 29

i have multiple columns from where i need to filter some data based on below conditions

Column A Like '%YT12-5%' and column B = '5656545' Similarly i have multiple values for column A and B. Now i want to add both the conditions in one where clause so that the query performs fuzzy search the values from A and values from B together from the dataset to show the matching result

select * from table T where "need the condition"

1 Answers

I would initially put your column B filter or filters if you have multiple. in the where first make sure you are picking up all of those. Then apply your AND and then set your parenthesis with you like statements with OR's to pick up any of those along with your = to ColumnB

SELECT
*
FROM
T1
WHERE
(ColumnB = '' OR ColumnB = '')
AND (ColumnA LIKE '' OR ColumnA LIKE '')
Related