选择列表中的列 'ICStockBillentry.FAmount' 无效,因为该列没有包含在聚合函数或 GROUP BY 子句中。
selectdistinctt1.FNameas'物料名称',t2.FAmountas'金额'fromt_itemt1innerjoin(selectFitemID,FA...
select distinct t1.FName as '物料名称',t2.FAmount as '金额'
from t_item t1
inner join (select FitemID,FAmount,FInterID,
SUM(FAmount) as '合计' from ICStockBillentry
group by FitemID
) as t2
on t1.FitemID=t2.FItemID
inner join ICStockBill t3 on t2.FInterID=t3.FInterID
inner join ictransactiontype t4 on t4.FBrNO=t3.FBrNO
where t3.FDate between '2008-01-01' and '2008-01-30'
and t4.FName='外购入库'
go
这是为什么啊?怎么解决呢? 展开
from t_item t1
inner join (select FitemID,FAmount,FInterID,
SUM(FAmount) as '合计' from ICStockBillentry
group by FitemID
) as t2
on t1.FitemID=t2.FItemID
inner join ICStockBill t3 on t2.FInterID=t3.FInterID
inner join ictransactiontype t4 on t4.FBrNO=t3.FBrNO
where t3.FDate between '2008-01-01' and '2008-01-30'
and t4.FName='外购入库'
go
这是为什么啊?怎么解决呢? 展开
展开全部
错误提示很明白啊,SQL语法错误,你试试下面的:
select distinct t1.FName as '物料名称',t2.FAmount as '金额'
from t_item t1
inner join (select FitemID,FInterID,
SUM(FAmount) as '合计' from ICStockBillentry
group by FitemID,FInterID
) as t2
on t1.FitemID=t2.FItemID
inner join ICStockBill t3 on t2.FInterID=t3.FInterID
inner join ictransactiontype t4 on t4.FBrNO=t3.FBrNO
where t3.FDate between '2008-01-01' and '2008-01-30'
and t4.FName='外购入库'
select distinct t1.FName as '物料名称',t2.FAmount as '金额'
from t_item t1
inner join (select FitemID,FInterID,
SUM(FAmount) as '合计' from ICStockBillentry
group by FitemID,FInterID
) as t2
on t1.FitemID=t2.FItemID
inner join ICStockBill t3 on t2.FInterID=t3.FInterID
inner join ictransactiontype t4 on t4.FBrNO=t3.FBrNO
where t3.FDate between '2008-01-01' and '2008-01-30'
and t4.FName='外购入库'
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询