Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Steve2106
Posting Yak Master
183 Posts |
Posted - 2010-03-30 : 10:03:17
|
| Hello,Can someone help me please.I have a site and I have been asked by the client if I can add a postage cost based on the weight of the item(sI need to create a table that will help do the calculation. I need to be able to select the correct record based on the weight calculation from the items chosen.).(I can already get the weight total)So if the user picks 3 items with a combined weight of say 7.45kg, in the new table I need to have something like:0 - 0.99kg £ 2.401 - 2.99kg £ 3.803 - 5.99kg £ 6.206 - 8.99kg £ 8.80as the combined weight of my items is 7.45kg the select command will return £ 8.80. If the combined weight was 4.20kg it would return 6.20How would I design the table I need and how would I write the select statement to select the right record based on the total weight.Thanks for any help you can give I really appreciate it.Best Regards,Steve |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-30 : 10:21:05
|
Table WeightCostid int (an identity column I would say)Weight_from int (weight in gram)Weight_to int (weight in gram)Cost money (or whatever)select Cost from WeightCostwhere your_weight_in_gram between Weight_from and Weight_to No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|
|