Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Convert SQL Statement to aggregate function

Hi

I have to convert the following into an aggregate function where I get a total for SOLD_AMOUNT and STOCK_UNITS and group by the rest. How do I convert this SQL Statement


SELECT PERIOD_END_DATE RETAILER, COL1, COL2, EAN_UPC_CODE, SOLD_AMOUNT, STOCK_UNITS
FROM `emea-datafoundat-gbl-emea-pd.d_sellout_warehouse_eu_pd.t_warehouse_sellout_v1` 
WHERE YEAR = CAST(FORMAT_DATE('%Y',CURRENT_DATE()) AS INT64)
AND UPPER(DATA_FILE_PROVIDER) LIKE "%PYTHON%"
AND DIVISION LIKE '%CPD%'
AND UNIVERSE LIKE '%MASS%'
AND market_flag LIKE '%L%'

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial