Microsoft.Jet.OLEDB.4.0中是否不支持完全外部联接?

时间:2014-06-08 15:31:12

标签: sql outer-join oledbdataadapter

我正在查询Dbf文件,我想在C#控制台应用程序中完全加入两个查询。但似乎Microsoft.jet.oledb.4.0不支持Full Join。运行查询时出现以下错误。

  

IErrorInfo.GetDescription因E_FAIL(0x80004005)而失败。

以下是表格详细信息和所需的查询行为。

  

购买和销售交易存储在表Mtrans.DBF中。字段It_type用于区分购买交易和销售交易。我想在一行中合并项目的销售和采购数量。

但是如果我使用左连接或内连接或右连接而不是完全连接,则查询运行顺利而没有任何错误。请帮帮我。如果这个错误有任何解决方法,我请求这里的专家打开一些指示灯。

这是我的查询EXpresision

OleDbDataAdapter da = new OleDbDataAdapter();

da = new OleDbDataAdapter("select purtran.it_name,purtran.it_code,
purtran.purcqnty,purtran.puruqnty,saltran.cqnty,
saltran.uqnty,saltran.avalue from 
(select first(it_name) as    
it_name,mtrans.it_code,sum(cqnty) as purcqnty,sum(uqnty)
as puruqnty 
from mtrans 
where date >=#" + fdt + "# and 
date <=#" + tdt + "# and  (voucher is null  or len(voucher) =0)
 and it_type = '01' 
group by it_code) as purtran
full join
(select it_code,sum(cqnty) as cqnty,
sum(uqnty) as uqnty,sum(avalue) as avalue,first(tp1) as tp1 
from mtrans 
where date >=#" + fdt + "# and date <=#" + tdt + "# 
and (voucher is null or len(voucher) = 0) and 
it_type = '02' group by it_code)
saltran  
on saltran.it_code = purtran.it_code ", con);
da.Fill(dt);

1 个答案:

答案 0 :(得分:1)

没有。 Access不支持FULL JOIN。您需要执行LEFT JOIN并使用UNION ALL和RIGHT JOIN组合结果。请参阅此tutorial