外部加入和内部加入

时间:2016-02-25 06:57:26

标签: sql duplicates inner-join outer-join

我使用inner joinouter join以下查询。执行此查询时,我得到重复的记录。我怎样才能获得独特的结果?

Select * 
    From DeliveryOrderMaster
Inner Join DeliveryOrder ON DeliveryOrderMaster.VoucherNo = DeliveryOrder.DONo
Inner Join Customer ON DeliveryOrderMaster.Code = Customer.ar_code
Left Outer Join tblbatchSerialNos On DeliveryOrder.DoNo = tblbatchSerialNos.VoucherNo And DeliveryOrder.StockCode = tblbatchSerialNos.ProductCode 
Where DeliveryOrderMaster.VoucherNo= 'DO01304' 
ORDER BY DeliveryOrder.DoNo ASC,DeliveryOrder.ID ASC

1 个答案:

答案 0 :(得分:0)

没有内部或左侧连接的问题。问题可能是表的类型。您确定使用了正确的连接表键吗?你能给出一个wath返回查询的例子吗?