【发布时间】:2013-03-28 21:03:19
【问题描述】:
我有 2 个日期字段,我试图在 where 子句中使用 OR。例如,
Select customer_records.customer_id, customer_records.join_date, rejected_customers.rejected_date, status_lookup.status_description
From customer_records, rejected_customers, status_lookup
Where status_lookup.status_id(+) = customer_records.status_id and customer_records.customer_id = rejected_customers.customer_id
and (customer_records.join_date between to_date('01-10-2012','dd-mm-yyyy') and to_date('01-11-2012','dd-mm-yyyy') or rejected_customers.rejected_date between to_date('01-10-2012','dd-mm-yyyy') and to_date('01-11-2012','dd-mm-yyyy')
所以,基本结果应该是,当加入日期或被拒绝日期落入我的日期字段时,我想要 customer_id。我似乎无法让它工作,感谢任何帮助,谢谢!
【问题讨论】:
-
当你说你不能让它工作时,你是什么意思?您收到错误消息、错误数据还是什么?
-
另外,您使用的是什么 RDMS?
-
oracle 10,我没有收到错误消息,但我收到了不正确的数据。我只得到 customer_records.join_date 而不是它的完整列表。