Order total greater than $10,000

  • Thread starter Thread starter Guest
  • Start date Start date
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));
 
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?
 
Back
Top