多次为 'd' 指定了列 'FBrNo,如何解决??
金蝶云社区-仙子姐姐
仙子姐姐
0人赞赏了该文章 1,394次浏览 未经作者许可,禁止转载编辑于2017年12月13日 17:24:10

select * from
(select a.fnumber as 物料代码,
a.fname as 物料名称,
a.fmodel as 规格,
b.Fqty as 数量,
-- d.fprice as 采购发票单价,
--e.fprice as 价格管理表单价,
row_number() over(partition by a.FNumber order by a.FNumber,d.Fcheckdate Desc) as row1,
row_number() over(partition by a.FNumber order by a.FNumber,e.fquotetime Desc) as row2,
c.fendbal/(case when c.fendqty=0 then 1 else c.FendQty end) as 结存表单价,
f.fname as 仓库
from t_icitem a
inner join icinventory b on a.fitemid=b.fitemid
Inner join t_stock f on b.fstockid=f.fitemid
left join
(
Select b.* from T_ICitem a
Left Join ICBal b On a.FItemID=b.FitemiD
inner Join
(
Select FItemID,Max(FYear*12+FPEriod) FQty from ICBal
Where FENdQTy>0
Group by FItemID
)s On b.FYear*12+b.FPEriod=s.FQty and b.FItemID=s.FItemID
) c on a.fitemid=c.fitemid
left join
(
select * from icpurchase aa inner join icpurchaseentry bb on aa.finterid=bb.finterid
)d on a.fitemid=d.fitemid --采购发票
left join
(
select * from t_supplyentry
)e on a.fitemid=e.fitemid --采购价格管理表
where f.fitemid in (701,705,707,708,709,710,711,712,713,715,716,719,720,721,722,724,725,726,733,735,18197,29785,45796) and b.fqty>0
)xxx
--where row1=1 or row2=1
--row_number() over(partition by 物料表.FNumber order by 物料表.FNumber,采购发票.FDate Desc,采购发票.FBillNo Desc) as row

报错内容:消息 8156,级别 16,状态 1,第 1 行
多次为 'd' 指定了列 'FBrNo'。