输入数据:
查询:
SELECT NumOM, Id_site,
SocieteClient,
Reference,
Designation,
SUM (NbPiecesCTR) AS NbPiecesCTR,
FROM
( SELECT DISTINCT
OMpda.NumOM AS NumOM,
OMpda.Id_site AS Id_site,
OMpda.NumTerminal AS NumTerminal,
OMpda.SocieteClient AS SocieteClient,
OMpda.Utilisateur AS Utilisateur,
OMpda.AJ AS AJ,
OMpda.Datesaisie AS Datesaisie,
OMpda.Période AS Période,
OMpda.Reference AS Reference,
OMpda.Designation AS Designation,
OMpda.NumBac AS NumBac,
OMpda.Demarrage AS Demarrage,
OMpda.FinOM AS FinOM,
OMpda.NbPiecesCTR AS NbPiecesCTR,
FROM OMpda
)
WHERE
Id_site={pNomSite}
AND Datesaisie={pDateOM}
AND NumOM={pNumom}
GROUP BY Id_site,
NumOM,
SocieteClient,
Datesaisie,
Reference,
Designation
我想通过USR获得和 对于USR XXX 360和NO 720,检查零件数量的总和
答案 0 :(得分:0)
SELECT DISTINCT Utilisateur,Inspected parts qty FROM OMpda GROUP BY Utilisateur,Inspected parts
很难理解你的需求。什么会给你720数量。 (忽略您在帖子中提供的查询。)