SQL_CACULATE (1 Viewer)

lwarren1968

Registered User.
Local time
Today, 01:12
Joined
Jan 18, 2013
Messages
77
I have a table (see below) that has redundant [UPC], however the [Available Qty] is different. What I need is a query that can list [UPC] without duplicates, which I was able to do using DISTINCT. But, I also need my query to return a grand total FILED for [Available Qty]. Any help with the calculation portion would be appreciated.

SELECT DISTINCT B2BinventoryGDL_TBL.UPC
FROM B2BinventoryGDL_TBL;



B2BinventoryGDL_TBL

SKUUPCStock TypeProduct StyleDescriptionDescription 2WarehouseAvailable QtyNext Arrival Date
A-SHIP1OZ022255371476CloseoutSHIP-0 GREASE 1OZ TUB(RD 8675/1 OZ TUB)IRV100
ABEANIECAMO022255470780CloseoutSHM BEANIESHM REVERSE BEANIE OSFM CAMONCH100
ABEANIENV022255470797CloseoutSHM BEANIESHM REVERSE BEANIE OSFM NVYNCH100
AHATBLKOUTBK022255073912SHM BLACKOUT CAPSHM BLACKOUT CAP OSFM BLKCOTTON/POLYESTERIRV65
AHATBLKOUTBK022255073912SHM BLACKOUT CAPSHM BLACKOUT CAP OSFM BLKCOTTON/POLYESTERNCH100
AHATCOMBBK022255470803SHM HONEYCOMBSHM HNYCMB MSH CAP OSFM BLKIRV13
AHATCOMBBK022255470803SHM HONEYCOMBSHM HNYCMB MSH CAP OSFM BLKNCH102020-06-10
AHATCOMBGY022255470827SHM HONEYCOMBSHM HNYCMB MSH CAP OSFM GRYIRV71
AHATCOMBGY022255470827SHM HONEYCOMBSHM HNYCMB MSH CAP OSFM GRYNCH100
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:12
Joined
Oct 29, 2018
Messages
21,449
Hi. You can use a Totals query. For example:

SQL:
SELECT UPC, Sum(Qty) As Total
FROM TableName
GROUP BY UPC
 

lwarren1968

Registered User.
Local time
Today, 01:12
Joined
Jan 18, 2013
Messages
77
Perfect. Thank you.
 

Users who are viewing this thread

Top Bottom