I have a table called table1 with two coloumns “id” and “name”.
The values are :
id name
----------------
(A1001 abc)
(A1002 bcd)
(A1003 cde)
(A1004 def)
I’m trying this query:
select distinct id,name
from table1
where id like '%1%' or name like '%c%' and id <> 'A1002'
It is not working. I want to get all the id and names that are like ‘1’ or ‘c’ but want to exclude the row whose id is ‘A1002’.
Use parenthesis,
andhas higher precedence thanor.