Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Write a SELECT statement that returns the InvoiceNumber and balance due for every invoice with a non-zero balance and an InvoiceDueDate thats less than

4. Write a SELECT statement that returns the InvoiceNumber and balance due for every invoice with a non-zero balance and an InvoiceDueDate thats less than one month from today.

5. Add a column to the query in question 4 that uses the RANK() function to return a column name BalanceRank that ranks the balance due in descending order.

Bonus: Write a SELECT statement that returns two columns from the GLAccounts table: AccountNo and AccountDescription. The result set should have one row for each account number that has not been used in the InvoiceLineItems table. Order the results by AccountNo. We want to find general ledger account numbers that have not been used, yet. Hint: Start by writing a query that lists all of the distinct AccountNo values in the InvoiceLineItems table and use that as a subquery in the operand of the NOT IN operator.

This is in SQL Studio Manager. For Question 4 I have already posted this question and recieved two incorrect answers.

This is the answer I got for question 4:

SELECT InvoiceDueDate, InvoiceNumber From Invoices WHERE InvoiceDueDate < DATEADD(m, DATEDIFF(m, 0, GETDATE()) + 1, 0) - 1 AND InvoiceNumber > 0

This is the error message attached to that:

Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '989319-457' to data type int.

Thank you for your help on these 3 parts of the question!

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions