我正在编写一个选择查询,我必须在两个地方编写相同的子查询
select e.MasterAccNumber from (
select MasterAccNumber from ACE_AccsLevelTran where CAST(timstmp as DATE) = '02/06/2013'
union all
select m.AccountNumber from ACE_InvLevelTran i left join ACE_InvLevelMaster m i.MasterInvNumber=m.InvoiceNo
where CAST(i.timstmp as date) ='02/06/2013' ) as e where e.MasterAccNumber not in(
select e.MasterAccNumber from e group by e.MasterAccNumber having COUNT( e.MasterAccNumber) > 1 )
在最后一个子查询中,解析器无法理解对象 e
select e.MasterAccNumber from e group by e.MasterAccNumber having COUNT( e.MasterAccNumber) > 1
如何写这样我就不会多次定义“e”。