试试这个:
--drop table a,b,ccreate table a(id int,name varchar(10))insert into a
select 1,'a' union all
select 2,'b' union all
select 3,'c'create table b(id int,name varchar(10),date datetime,flag int) insert into b
select 11,'元旦','2014-01-01',1 union all
select 12,'除夕','2014-01-30',1create table c(id int,关联个人id int,name varchar(20),date datetime,flag int) insert into c
select 21,1,'元旦上班','2014-01-01',2 union all
select 22,1,'元旦调休','2014-01-07',1
go
select a.id,b.date
from a
inner join b
        on b.flag = 1
left join c
       on a.id = c.关联个人id
          and c.flag = 2
          and b.date = c.date
where c.date is null          union allselect a.id,c.date
from a
inner join c
        on a.id = c.关联个人id
           and c.flag = 1 
order by id,date       
/*
id date
1 2014-01-07 00:00:00.000
1 2014-01-30 00:00:00.000
2 2014-01-01 00:00:00.000
2 2014-01-30 00:00:00.000
3 2014-01-01 00:00:00.000
3 2014-01-30 00:00:00.000
*/