I'm not looking for others to do my homework, I just want help with getting an idea one what to do.
My class was given an assignment and one of the questions is:
Create a query that will show the order id, item id, price, sales tax and subtotal for all items in the order item table. Create column aliases to describe the sales tax and subtotal columns. Only include in your output those items that
sold for $20 or more. Order your output by order id. Your output should look like the following:
orderid Item ID Price Sales Tax Subtotal
1004 1004 32.50 1.9500 34.4500
1016 1020 47.95 2.8770 50.8270
1018 1018 47.50 2.8500 50.350
Here is what I got so far:
select *
,cast(round((price) * 0.06, 4)as numeric(6,4)) as [Sales Tax]
--,cast(price as varchar(10)) as [Subtotal]
,cast(price + [Subtotal] as varchar(20)) as [Subtotal]
from order_item
where price >= 20
order by orderid asc;
I don't know what I'm doing wrong. I got everything else correct, but I am stumped at the part with finding the subtotal, would someone be able to give me an idea on what I should do?