Professional Documents
Culture Documents
SELECT
WAREHOUSE_ID,
MAX(physical_country) as COUNTRY_CODE
FROM monster.WAREHOUSES
WHERE region_id=2
GROUP BY 1);
WHERE MRS.REGION_ID=2
and MRSI.REGION_ID=2
AND trunc(shipment_date) BETWEEN TO_DATE('2020-01-01', 'YYYY-MM-DD') AND
TO_DATE('2020-12-31', 'YYYY-MM-DD')
and mr.address_country_code is not null
and mr_fulfillment_channel in ('RETURN')
group by 1,2,3
);
SELECT
merchant_customer_id,
case when WAREHOUSE_ID in ('UK','GB') then 'UK'
else 'EU_Other'
end as from_country,
to_country,
sum(shipped_units) as shipped_units
from orders o left join WA on o.amzn_fulfillment_center_id = WA.WAREHOUSE_ID
where from_country <> to_country
group by 1,2,3
order by shipped_units desc