SELECT
	(suma+suma1+suma2)AS revenue
	
FROM
	(SELECT 
	CASE
	WHEN sum(extendedprice*(1-discount))>0 THEN sum(extendedprice*(1-discount))
	ELSE 0
	END AS suma
	FROM
		part,
		lineitem
	WHERE
	(
		part.partkey=lineitem.partkey
		AND part.brand='Brand#12'
		AND part.container IN('SM CASE','SM BOX','SM PACK','SM PKG')
		AND lineitem.quantity>=1 AND lineitem.quantity<=1+10
		AND part.size BETWEEN 1 AND 5
		AND lineitem.shipmode IN ('AIR','AIR REG')
		AND lineitem.shipinstruct='DELIVER IN PERSON'
	))AS resultado,
	(SELECT 
	CASE
	WHEN sum(extendedprice*(1-discount))>0 THEN sum(extendedprice*(1-discount))
	ELSE 0
	END AS suma1
	FROM
		part,
		lineitem
	WHERE
	(
		part.partkey=lineitem.partkey
		AND part.brand='Brand#23'
		AND part.container IN('MED BAG','MED BOX','MED PACK','MED PKG')
		AND lineitem.quantity>=10 AND lineitem.quantity<=20
		AND part.size BETWEEN 1 AND 10
		AND lineitem.shipmode IN ('AIR','AIR REG')
		AND lineitem.shipinstruct='DELIVER IN PERSON'
	))AS resultado2,
	(SELECT 
	CASE
	WHEN sum(extendedprice*(1-discount))>0 THEN sum(extendedprice*(1-discount))
	ELSE 0
	END AS suma2
	FROM
		part,
		lineitem
	WHERE
	(
		part.partkey=lineitem.partkey
		AND part.brand='Brand#34'
		AND part.container IN('LG CASE','LG BOX','LG PACK','LG PKG')
		AND lineitem.quantity>=20 AND lineitem.quantity<=30
		AND part.size BETWEEN 1 AND 15
		AND lineitem.shipmode IN ('AIR','AIR REG')
		AND lineitem.shipinstruct='DELIVER IN PERSON'
	))AS resultado3;
