展开全部
SELECT [型号表].[型号],
ISNULL(SUM([领料表].[领用个数]),0) AS [共领料],
ISNULL(SUM([入库表].[入库数量]),0) AS [共入库]
FROM [型号表]
LEFT JOIN [领料表] ON [型号表].[型号] = [领料表].[型号]
LEFT JOIN [入库表] ON [型号表].[型号] = [入库表].[型号]
GROUP BY [型号表].[型号] 以上正解。多余的话,还可以加ORDER BY [型号表].[型号]。用LEFT JOIN 方式好像不方便用简名的。
ISNULL(SUM([领料表].[领用个数]),0) AS [共领料],
ISNULL(SUM([入库表].[入库数量]),0) AS [共入库]
FROM [型号表]
LEFT JOIN [领料表] ON [型号表].[型号] = [领料表].[型号]
LEFT JOIN [入库表] ON [型号表].[型号] = [入库表].[型号]
GROUP BY [型号表].[型号] 以上正解。多余的话,还可以加ORDER BY [型号表].[型号]。用LEFT JOIN 方式好像不方便用简名的。
展开全部
SELECT [型号表].[型号],
ISNULL(SUM([领料表].[领用个数]),0) AS [共领料],
ISNULL(SUM([入库表].[入库数量]),0) AS [共入库]
FROM [型号表]
LEFT JOIN [领料表] ON [型号表].[型号] = [领料表].[型号]
LEFT JOIN [入库表] ON [型号表].[型号] = [入库表].[型号]
GROUP BY [型号表].[型号]
ISNULL(SUM([领料表].[领用个数]),0) AS [共领料],
ISNULL(SUM([入库表].[入库数量]),0) AS [共入库]
FROM [型号表]
LEFT JOIN [领料表] ON [型号表].[型号] = [领料表].[型号]
LEFT JOIN [入库表] ON [型号表].[型号] = [入库表].[型号]
GROUP BY [型号表].[型号]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select 型号,sum(领用个数) as 共领料,sum(入库数量)as 共入库
from 型号表,领料表,入库表
where 型号表.型号=领料表.型号 and 型号表.型号=入库表.型号
group by 型号
from 型号表,领料表,入库表
where 型号表.型号=领料表.型号 and 型号表.型号=入库表.型号
group by 型号
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select c.型号,sum(a.领用个数) ,sum(b.入库个数)
from 领料表 a,入库表 b,型号表 c
where a.型号=b.型号
and a.型号=c.型号
group by c.型号
from 领料表 a,入库表 b,型号表 c
where a.型号=b.型号
and a.型号=c.型号
group by c.型号
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询