This should work with SQL Server

update table1
set price = b.price
from table1 a join table2 b on a.productid = b.productid
and a.modelno = b.modelno

> > I have two tables in a DB containing information about the same
> > products. Table 1 is comprehensive and has complete details about
> > the products. Table 2 has fewer no of fields. The fields common in
> > both Table 1 and Table 2 are productid, modelno, price, details .
> >
> > Table1.price contains the old price.
> > Table2. price is the latest price.
> >
> > I want to update Table1.price with the values in Table2.price and
> > use modelno as the unique value for this update.
> >
> > Can someone please help.
> > My SQL knowlede is very basic.
> > Also what if  Table two consists of new products not included in
> > Table 1.? What syntax Should  I use?
> >
> >
> > Thanks
> > JB
> >
> >
> > 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to