ORACLE SQL LIKE OR CONDITION(喜欢或条件)。

问题描述 投票:0回答:1

我试图将 "喜欢 "条件与其他条件一起使用,但它不能正常工作。我试图获取2013年的数据,但当我应用。

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

当我使用'or'时,它给我的是所有年份的结果,而不是我想要的2013年的结果。我应该怎么做才能只得到2013年的结果?

oracle plsql conditional-statements sql-like or-condition
1个回答
1
投票

试试

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%')
© www.soinside.com 2019 - 2024. All rights reserved.