Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to write a query to Write a subquery to return one row per vendor, representing the vendors earliest invoice_due_date. Each row should

I am trying to write a query to "Write a subquery to return one row per vendor, representing the vendors earliest invoice_due_date. Each row should include ( vendor name, vendor_id, count of invoices, the earliest invoice due date. Filter the result set to only show the rows with more than 3 count of invoices." This is my query so far

select i.vendor_name, i.vendor_id, count(invoice_id) as number_of_invoices, min(invoice_due_date) as earliest_due_date

from vendors i join

(select vendor_id, count(invoice_id) as number_of_invoices, min(invoice_due_date) as earliest_due_date

from invoices

group by vendor_id

having count(invoice_id) > 3) v

on i.VENDOR_ID = v.VENDOR_ID

group by i.VENDOR_ID, i.vendor_name;

I get this error "

ORA-00904: "INVOICE_DUE_DATE": invalid identifier

00904. 00000 - "%s: invalid identifier"

*Cause:

*Action:

Error at Line: 1 Column: 81"

NOTE: the vendor name column belongs to the vendors table and the vendor_id is the primary key in the vendors table and a foreign key in the invoices table. All other columns belong to invoices table.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

a. How will the leader be selected?

Answered: 1 week ago