Hi I'm trying to write a SQL statement and having issues using the 'ordercost' column in my WHERE clause.
The result set should produce 11 rows with dates between 'Jan 1 1992' AND 'Mar 30 1992' and also cost more than $1,500. With the code below I'm getting an error about 'column not valid'.
I suspect I may need to use a subquery or could be way off but after searching for the last 3 hours I'm unsure how to complete this.
Anyone have any suggestions on how to format this?
select orders.orderid,
products.productname,
customers.CompanyName,
orderdate = CONVERT(char(11), orders.orderdate, 100),
newshippeddate = CONVERT(char(11), orders.shippeddate + 10 , 100),
ordercost = (OrderDetails.Quantity * Products.UnitPrice)
from orders`enter code here`
INNER JOIN orderdetails ON orders.orderid = orderdetails.orderid
INNER JOIN products ON orderdetails.productid = products.productid
INNER JOIN customers ON orders.customerid = customers.customerid
where orders.orderdate BETWEEN 'Jan 1 1992' AND 'Mar 30 1992'
AND ordercost >= 1500.00