我是SQL的新手,任何人都可以回答我的问题是什么?!感谢。
SELECT
bom.Parent_Material_Number,
mm.Material_Number,
mm.Material_Descr_HU,
bom.Child_Material_Number
FROM mm,bom
GROUP BY mm.Material_Descr_HU
答案 0 :(得分:0)
我看到你从两个表mm和bomz FROM mm,bomz
中取记录,并且在你的陈述中没有这个的连接条款。
答案 1 :(得分:0)
您的查询错误。如果您打算使用GROUP BY
子句,请确保取消组合字段具有SUM(), MIN(), MAX(), etc
等聚合。请参阅下面的示例:
SELECT
MIN(bom.Parent_Material_Number),
MAX(mm.Material_Number),
mm.Material_Descr_HU,
MIN(bom.Child_Material_Number)
FROM mm,bom
WHERE bom.Parent_Material_Number = mm.Material_Number
GROUP BY mm.Material_Descr_HU;
您还可以显式加入。见下文:
SELECT
MIN(bom.Parent_Material_Number),
MAX(mm.Material_Number),
mm.Material_Descr_HU,
MIN(bom.Child_Material_Number)
FROM mm INNER JOIN bom
ON bom.Parent_Material_Number = mm.Material_Number
GROUP BY mm.Material_Descr_HU;
答案 2 :(得分:0)
您需要一个JOIN或WHERE子句来将表链接在一起