SlideShare a Scribd company logo
1 of 1
Download to read offline
Explain (in plain English) what each line (line by line) of the query below does. SELECT
vendor_state, vendor_city, vendor_name, COUNT(*) AS invoice_qty, AVG(invoice_total) AS
invoice_average FROM invoices JOIN vendors ON invoices.vendor_id = vendors.vendor_id
WHERE vendor_state < 'e' GROUP BY vendor_state, vendor_city, vendor_name HAVING
SUM(invoice_total) > 500 ORDER BY vendor_state, vendor_city, vendor_name

More Related Content

More from anbika110

Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf
 Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf
Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdfanbika110
 
Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf
 Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf
Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdfanbika110
 
Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf
 Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf
Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdfanbika110
 
Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf
 Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf
Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdfanbika110
 
Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf
 Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf
Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdfanbika110
 
Fill in the array with the values that would be stored after the code.pdf
 Fill in the array with the values that would be stored after the code.pdf Fill in the array with the values that would be stored after the code.pdf
Fill in the array with the values that would be stored after the code.pdfanbika110
 
Figure 3 People with no qualifications and degree level qualificatio.pdf
 Figure 3 People with no qualifications and degree level qualificatio.pdf Figure 3 People with no qualifications and degree level qualificatio.pdf
Figure 3 People with no qualifications and degree level qualificatio.pdfanbika110
 
Exercise 4 Write a C function that takes a positive integer n as an .pdf
 Exercise 4 Write a C function that takes a positive integer n as an .pdf Exercise 4 Write a C function that takes a positive integer n as an .pdf
Exercise 4 Write a C function that takes a positive integer n as an .pdfanbika110
 
Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf
 Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf
Figure Strawberries and Submarines The opportunity cost of 1 submari.pdfanbika110
 
FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf
 FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf
FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdfanbika110
 
Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf
 Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf
Fil in the P(X=x) values to give a legnimute probabiity distribution .pdfanbika110
 
Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf
 Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf
Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdfanbika110
 
Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf
 Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf
Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdfanbika110
 
Figure External Benefits The distance between point E and point M re.pdf
 Figure External Benefits The distance between point E and point M re.pdf Figure External Benefits The distance between point E and point M re.pdf
Figure External Benefits The distance between point E and point M re.pdfanbika110
 
Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf
 Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf
Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdfanbika110
 
fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf
 fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf
fartord Jeweiers uses a perpetual inventory systam and had the follow.pdfanbika110
 
Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf
 Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf
Fancy Ciothing Company is authorized to issue 110.000 shares of.pdfanbika110
 
Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf
 Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf
Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdfanbika110
 
Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf
 Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf
Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdfanbika110
 
Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf
 Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf
Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdfanbika110
 

More from anbika110 (20)

Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf
 Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf
Exercise 5-22 (Static) Recording Capital Projects Fund Transactions [.pdf
 
Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf
 Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf
Exercise 4.4 (Algo) Multiple-step continuous statement of comprehensi.pdf
 
Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf
 Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf
Exercise 4-5 (Algo) Income statement presentation [LO4-1] The followi.pdf
 
Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf
 Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf
Exercise 4-4 (Algo) Multiple-step continuous statement of comprehensi.pdf
 
Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf
 Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf
Exercise 4-5 (Algo) Income statement presentation [LO 4-1] The follow.pdf
 
Fill in the array with the values that would be stored after the code.pdf
 Fill in the array with the values that would be stored after the code.pdf Fill in the array with the values that would be stored after the code.pdf
Fill in the array with the values that would be stored after the code.pdf
 
Figure 3 People with no qualifications and degree level qualificatio.pdf
 Figure 3 People with no qualifications and degree level qualificatio.pdf Figure 3 People with no qualifications and degree level qualificatio.pdf
Figure 3 People with no qualifications and degree level qualificatio.pdf
 
Exercise 4 Write a C function that takes a positive integer n as an .pdf
 Exercise 4 Write a C function that takes a positive integer n as an .pdf Exercise 4 Write a C function that takes a positive integer n as an .pdf
Exercise 4 Write a C function that takes a positive integer n as an .pdf
 
Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf
 Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf
Figure Strawberries and Submarines The opportunity cost of 1 submari.pdf
 
FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf
 FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf
FILE Divorce. Divorce has become an increasingly prevalent part of Am.pdf
 
Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf
 Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf
Fil in the P(X=x) values to give a legnimute probabiity distribution .pdf
 
Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf
 Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf
Figure 8-2 igure 8-2 shows the macro PPF. Which point(s) represent re.pdf
 
Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf
 Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf
Figure 10.4 ASCll-to-binary conversion subroutine (Fig. 10.4 continue.pdf
 
Figure External Benefits The distance between point E and point M re.pdf
 Figure External Benefits The distance between point E and point M re.pdf Figure External Benefits The distance between point E and point M re.pdf
Figure External Benefits The distance between point E and point M re.pdf
 
Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf
 Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf
Figure 2-6 Refer to Figure 2-6. What was the most likely cause of the.pdf
 
fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf
 fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf
fartord Jeweiers uses a perpetual inventory systam and had the follow.pdf
 
Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf
 Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf
Fancy Ciothing Company is authorized to issue 110.000 shares of.pdf
 
Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf
 Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf
Fare 14.3 Consumer Giscrebionary 13.9 Communication services 10..pdf
 
Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf
 Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf
Fail and Fair, ncoepted an engagement to oudit the financhi statement.pdf
 
Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf
 Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf
Factory Overhead Cost Budget Sweet Tooth Candy Company budgeted the f.pdf
 

Recently uploaded

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 

Recently uploaded (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 

Explain (in plain English) what each line (line by line) of the que.pdf

  • 1. Explain (in plain English) what each line (line by line) of the query below does. SELECT vendor_state, vendor_city, vendor_name, COUNT(*) AS invoice_qty, AVG(invoice_total) AS invoice_average FROM invoices JOIN vendors ON invoices.vendor_id = vendors.vendor_id WHERE vendor_state < 'e' GROUP BY vendor_state, vendor_city, vendor_name HAVING SUM(invoice_total) > 500 ORDER BY vendor_state, vendor_city, vendor_name