Discover the best answers at Westonci.ca, where experts share their insights and knowledge with you. Get detailed answers to your questions from a community of experts dedicated to providing accurate information. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.

with top5 as (select top 5 vendorid, avg(invoicetotal) as avginvoice from invoices group by vendorid order by avginvoice desc) select invoices.vendorid, max(invoices.invoicetotal) as largestinvoice from invoices join top5 on invoices.vendorid