Order total greater than $10,000

G

Guest

This is a school asmt where I need to pull the total > $10,000 using SQL, not
the design view. I tried the below, but it asks for the parameter value of
OrderTotal, then comes up blank.

SELECT OrderID, (UnitPrice * Quantity) - (UnitPrice*Quantity*Discount) AS
OrderTotal
FROM [Order Details]
WHERE OrderTotal > 10000;

By using the Design view, I see that the below statement works, but I'm
hoping someone can explain why my 1st attempt does not since I'm not supposed
to be using the Design view.

SELECT [Order Details].OrderID,
(UnitPrice*Quantity)-(UnitPrice*Quantity*Discount) AS OrderTotal
FROM [Order Details]
WHERE ((((UnitPrice*Quantity)-(UnitPrice*Quantity*Discount))>10000));
 
S

Smartin

Tina said:
This is a school asmt where I need to pull the total > $10,000 using SQL, not
the design view. I tried the below, but it asks for the parameter value of
OrderTotal, then comes up blank.

SELECT OrderID, (UnitPrice * Quantity) - (UnitPrice*Quantity*Discount) AS
OrderTotal
FROM [Order Details]
WHERE OrderTotal > 10000;

By using the Design view, I see that the below statement works, but I'm
hoping someone can explain why my 1st attempt does not since I'm not supposed
to be using the Design view.

SELECT [Order Details].OrderID,
(UnitPrice*Quantity)-(UnitPrice*Quantity*Discount) AS OrderTotal
FROM [Order Details]
WHERE ((((UnitPrice*Quantity)-(UnitPrice*Quantity*Discount))>10000));

I've never understood why aliasing like that doesn't work either (^:

Are you sure this is giving you the answer you want? The assignment says
"*Order total* greater than $10,000". It looks like you are calculating
line items greater than 10000. Won't you miss order IDs that have
multiple order details SUMming up to > 10000?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top