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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql query -??

Author  Topic 

josh777
Starting Member

12 Posts

Posted - 2007-03-20 : 16:43:59
I need some help with this query .
There are two tables ItemDetails, Freight
Item details has Item,Quantity,UnitPrice
Freight has Freightcharges and other columns

Bases on different unit prices i have to set the Freight

With a single query i want to set the freightcharges in the freight table based on the unitprice in the Itemdetails table

select UnitPrice,Quantity,
Freightcharge =
Case
when temDetails.UnitPrice between 0 and 500 then
quantity*15
when ItemDetails.UnitPrice between 500 and 1000 then
quantity*20
when ItemDetails.UnitPrice between 1000 and 2000 then
quantity*25
when ItemDetails.UnitPrice > 2000 then
quantity*30
else
null
end
from ItemDetails

i want this freightcharge to be assigned directly to the Freight table. Thank you for your help.

regards,
josh

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-20 : 21:44:52
what is the relationship between Freight and ItemDetails ?


KH

Go to Top of Page

josh777
Starting Member

12 Posts

Posted - 2007-03-21 : 14:47:48
The relation between freight and Item details is that they have same items. Freight is the additional expense for a item.
Freight.item ,Itemdetails.Item.
Go to Top of Page
   

- Advertisement -