calgarychinese
MIS
Hi there
I'm trying to generate a report. User will give a date as a filter.
There are 2 tables to consider, A and B. Both contain a date field against which the user-provided date is checked.
I want to do it so if the record for an employee is found in B, then use the B's date field as the where clause. If it's not found, then use A's date field as the where clause.
So.....
select A.*, B.*
from tblA A, tblB B
WHERE
-- if exists (select * from tblB where B.EmpID=123) then B.DateValue = %USERDATE%
-- else A.DateValue = %USERDATE%
Is it doable?
Thanks
CC
I'm trying to generate a report. User will give a date as a filter.
There are 2 tables to consider, A and B. Both contain a date field against which the user-provided date is checked.
I want to do it so if the record for an employee is found in B, then use the B's date field as the where clause. If it's not found, then use A's date field as the where clause.
So.....
select A.*, B.*
from tblA A, tblB B
WHERE
-- if exists (select * from tblB where B.EmpID=123) then B.DateValue = %USERDATE%
-- else A.DateValue = %USERDATE%
Is it doable?
Thanks
CC