Expression or Statement Help Please

mkl938

New member
Joined
Dec 9, 2011
Messages
1
Programming Experience
Beginner
sql forums


Hello

This is my first post in this wonderful forum.
I am new to programming and sql

I am finding it hard to understand how to do the following excercise from a tutorial.

I dont understand what I should be using to work this out or how to do it, as I say I am very

new to this

I have a datafeed, in which I have a
cost price (column 12) (from a supplier)
weight of an item (column 15)

Now the supplier charges shipping based on weight for example if an item is

0.001 - 1.000 kg then £7
1.001 - 2.000 kg then £9
2.001 - 5.000 kg then £11

So in order to work out my total cost price of an item I need to check the weight and then get

the right shipping price and then add that to the cost price of the item.

After that I need to add a profit margin of 3% and vat of 20%

for example a product price is £3.00 and weight is 1.500 kg

total cost price would be £3.00 + £9.00 = £12.00

Then add profit margin 3%

£12.00 * 1.03 = £12.36

Then add vat rate 20%

£12.36 * 1.20

My sell price would be

£14.83

How can I do this in SQL please.



Kind Regards
 
Last edited:
table Item is (good idea to have VAT as a variable):
Item, CostPrice, Weight, VATRate

table ShipPrice is:
WeightLower, WeightUpper, Price

SQL is:

VB.NET:
Expand Collapse Copy
SELECT
  (CostPrice + ShipPrice.Price) * 1.03 * VATRate
FROM
  Item
  INNER JOIN
  ShipPrice
  ON
    Item.Weight BETWEEN ShipPrice.WeightLower AND ShipPrice.WeightUpper
 
Back
Top