Farkhod Giyasov
Farkhod Giyasov

Reputation: 9

ORACLE SQL LIKE OR CONDITION

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?

Upvotes: 0

Views: 222

Answers (1)

Digvijay S
Digvijay S

Reputation: 2705

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%')

Upvotes: 1

Related Questions