Good Morning Everybody,
This is my first discussion so please bare with me.
I am trying to write a case statement that has a select statement in it that compares dates.
When I write a case statement with a select in it that compares anything but dates it works just fine. Once the date gets in there it falls apart.
Below is a super simple example of what I am trying to do, "b.in_serv_dt" is a date
select unit_no,
case when ((select b.in_serv_dt from unit_dept_comp_main b where a.unit_id = b.unit_id and b.in_serv_dt) >= '01-JAN-2012') then 'everybody wins'
when ((select b.in_serv_dt from unit_dept_comp_main b where a.unit_id = b.unit_id and b.in_serv_dt) <= '01-JAN-2012') then 'nobody wins'
end
from ottawa_unitmain_v a
Any help would be greatly appreciated
Thank you very much