关于union all的 问题 ,求教。
稽姬 2007-08-30 05:04:40 Select t_4.*
From (Select t_2.*
From Extend_Daily_Report t_2
Where t_2.Dr_User_Id = '1920'
Union All
Select t_0.*
From Extend_Daily_Report t_0, Extend_Daily_Task t_1
Where t_0.Dr_Id = t_1.Dr_Id And t_1.Dt_Pm_Id = '1920' And (t_0.Dr_Status = '1' Or t_0.Dr_Status = '2') And
t_0.Dr_Dept_Id <> '2008'
Union All
Select t_3.*
From Extend_Daily_Report t_3
Where (t_3.Dr_Status = '1' Or t_3.Dr_Status = '2') And t_3.Dr_Dept_Id = '2008' And t_3.dr_user_id<>'1920') t_4
工作中写了一个这样得 sql 实现了我的需求,感觉用union 不妥。由于小弟sql很差求教各位给出一个不用union all 的 sql 来实现这个功能。多谢