ORACLE SQL LIKE OR CONDITION

210 Views Asked by At

I am trying to use Like condition along with other conditions but it is not working properly. I am trying to get data from 2013 but when I apply:

where o.order_date between to_date(01.01.2013, 'dd.mm.yyyy') and to_date(31.12.2013, 'dd.mm.yyyy')
and   s.supplier_name like '%IDEAL%' or '%ideal%'
and   p.product_name like '%BOOK%' or '%book%'

When I use 'or' it gives me the result from all years and not only from 2013 as I want. What should I do to get the results only from 2013?

1

There are 1 best solutions below

1
On

Try

Where (o.order_date between to_date (01.01.2013, 'dd.mm.yyyy') and to_date (31.12.2013, 'dd.mm.yyyy'))

And (s.Supplier_name like '%IDEAL%' or s.Supplier_name like  '%ideal%')

And (p.product_name like '%BOOK%' or p.product_name like '%book%')