1
Thanks for your help. I am not very advanced in SQL and I am facing a difficulty here, is the following:
SELECT tbl_afs_pregao.numaf,
tbl_items_pregao.nomeitem,
Sum(tbl_items_af.qtd) AS SomaDeQtd,
tbl_items_pregao.id_itempregao
FROM (tbl_afs_pregao
INNER JOIN tbl_items_af
ON tbl_afs_pregao.id_af = tbl_items_af.id_af)
INNER JOIN tbl_items_pregao
ON tbl_items_af.id_itempregao = tbl_items_pregao.id_itempregao
GROUP BY tbl_afs_pregao.numaf,
tbl_items_pregao.nomeitem,
tbl_items_pregao.id_itempregao;
The point is that I wanted to group the results of those items, SUNPATIENS by the sum of the quantity, but not getting it (1 hour almost trying and already gave rs).
I thank you all,
Hug
You’re grouping too by
tbl_afs_pregao.numaf
and the 2 lines ofSUNPATIENS
shown have different values for this field (1374/2020 and 1522/2020).– anonimo