MySql-从主表和第二表创建总和
我在MySql中有两个表:MySql-从主表和第二表创建总和,mysql,Mysql,我在MySql中有两个表: main: 和_fakture 字段:id,organizatorId,… 秒: 还有(u stavke) 字段:id,idFakture,ukupno,。。。 where和_fakture.id=和_stavke.idFakture ukupno是数字的 我怎样才能从organizatorId中求和(ukupno)?你的问题不是很清楚,但你想要这样的东西吗 SELECT organizatorId, SUM(ukupno) FROM and_fakture INN
我怎样才能从organizatorId中求和(ukupno)?你的问题不是很清楚,但你想要这样的东西吗
SELECT organizatorId, SUM(ukupno)
FROM and_fakture
INNER JOIN and_stavke ON and_fakture.id = and_stavke.idFakture
GROUP BY organizatorId
这将为您提供每个组织的ukupno总和太好了,它有助于您标记为正确答案。谢谢