First page Back Continue Last page Image

A Window Example with multiple functions

SELECT vendor_id, invoice_date, invoice_total,

SUM(invoice_total) OVER(PARTITION BY vendor_id)

AS vendor_total,

ROUND(AVG(invoice_total) OVER(PARTITION BY vendor_id), 2)

AS vendor_avg,

MAX(invoice_total) OVER(PARTITION BY vendor_id)

AS vendor_max,

MIN(invoice_total) OVER(PARTITION BY vendor_id)

AS vendor_min

FROM invoices

WHERE invoice_total > 5000