D
DawnTreader
Hello All
another wierd query question. i have a union query where i get some
duplicated part numbers. there is a field that i would like to show the
actual data for, but i would like to show the quantities as a sum. let say i
have 2 lines where the part number is 321123 and a qty of 5 and the other
line is a qty of 3, for a total of 8. but i also have a field called Ref
which has 110 and 320 respectively in each of the 2 records returned for part
number 321123.
is there a way to get both Ref numbers and sum the qty at the same time? can
you concatenate across records in the same field?
i suspect that i am asking too much of access, but i am just curious. here
is my sql that produces the multiple record results:
SELECT
utblRebuildPartList.ProdID,
utblRebuildPartList.IMWPNID,
sum(utblRebuildPartList.PartBlockQTY) AS PBQTY,
utblRebuildPartList.Ref
FROM
utblRebuildPartList
GROUP BY ProdID, IMWPNID, Ref
UNION SELECT
tblProductList.ProductID AS ProdID,
tblCBAPartList.IMWPartNumberID AS IMWPNID,
tblCBAPartList.QTY AS PBQTY,
"CBA" AS Ref
FROM
((tblCBBANumbers RIGHT JOIN (tblProductList LEFT JOIN subdatatblCompressor
ON (tblProductList.ProductTypeID = subdatatblCompressor.ProductTypeID)
AND (tblProductList.ProductID = subdatatblCompressor.ProductID))
ON tblCBBANumbers.CBBAID = subdatatblCompressor.CBAEMID)
LEFT JOIN tblCBAPartList ON tblCBBANumbers.CBBAID = tblCBAPartList.CBAID)
LEFT JOIN utblRebuildPartList ON tblCBAPartList.IMWPartNumberID =
utblRebuildPartList.IMWPNID
WHERE
(((tblProductList.ProductID)=669) AND ((tblCBAPartList.IMWPartNumberID)
Is Not Null) AND ((utblRebuildPartList.IMWPNID) Is Null))
ORDER BY IMWPNID;
the reason i would like to be able to do this concatenating is so that i can
still know the areas of the product where those parts go, hence the Ref
field. it Refers to a number on a drawing.
another wierd query question. i have a union query where i get some
duplicated part numbers. there is a field that i would like to show the
actual data for, but i would like to show the quantities as a sum. let say i
have 2 lines where the part number is 321123 and a qty of 5 and the other
line is a qty of 3, for a total of 8. but i also have a field called Ref
which has 110 and 320 respectively in each of the 2 records returned for part
number 321123.
is there a way to get both Ref numbers and sum the qty at the same time? can
you concatenate across records in the same field?
i suspect that i am asking too much of access, but i am just curious. here
is my sql that produces the multiple record results:
SELECT
utblRebuildPartList.ProdID,
utblRebuildPartList.IMWPNID,
sum(utblRebuildPartList.PartBlockQTY) AS PBQTY,
utblRebuildPartList.Ref
FROM
utblRebuildPartList
GROUP BY ProdID, IMWPNID, Ref
UNION SELECT
tblProductList.ProductID AS ProdID,
tblCBAPartList.IMWPartNumberID AS IMWPNID,
tblCBAPartList.QTY AS PBQTY,
"CBA" AS Ref
FROM
((tblCBBANumbers RIGHT JOIN (tblProductList LEFT JOIN subdatatblCompressor
ON (tblProductList.ProductTypeID = subdatatblCompressor.ProductTypeID)
AND (tblProductList.ProductID = subdatatblCompressor.ProductID))
ON tblCBBANumbers.CBBAID = subdatatblCompressor.CBAEMID)
LEFT JOIN tblCBAPartList ON tblCBBANumbers.CBBAID = tblCBAPartList.CBAID)
LEFT JOIN utblRebuildPartList ON tblCBAPartList.IMWPartNumberID =
utblRebuildPartList.IMWPNID
WHERE
(((tblProductList.ProductID)=669) AND ((tblCBAPartList.IMWPartNumberID)
Is Not Null) AND ((utblRebuildPartList.IMWPNID) Is Null))
ORDER BY IMWPNID;
the reason i would like to be able to do this concatenating is so that i can
still know the areas of the product where those parts go, hence the Ref
field. it Refers to a number on a drawing.