-- using default substitutions

/* TPC_H  Query 3 - Shipping Priority */

SELECT	TOP 10
	L_ORDERKEY,
	SUM(L_EXTENDEDPRICE*(1-L_DISCOUNT))	AS REVENUE,
	O_ORDERDATE,
	O_SHIPPRIORITY
FROM	CUSTOMER,
	ORDERS,
	LINEITEM
WHERE	C_MKTSEGMENT	= 'BUILDING' AND
	C_CUSTKEY	= O_CUSTKEY AND
	L_ORDERKEY	= O_ORDERKEY AND
	O_ORDERDATE	< '1995-03-15' AND
	L_SHIPDATE	> '1995-03-15'
GROUP	BY	L_ORDERKEY,
		O_ORDERDATE,
		O_SHIPPRIORITY
ORDER	BY	REVENUE DESC,
		O_ORDERDATE
