UPDATE products
SET dprice = dealerprice.price
FROM products, dealerprice
WHERE products.code = dealerprice.code

--
Michael Wolfe
[EMAIL PROTECTED]

-----Original Message-----
From: Cantrell, Adam [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 1:58 PM
To: CF-Talk
Subject: RE: updating with a sub query

Would this work?

UPDATE products
SET products.dprice = dealerprice.price
WHERE products.code = dealerprice.code

-----Original Message-----
From: Jim T [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 2:56 PM
To: CF-Talk
Subject: updating with a sub query

<cfquery name="getcodes" datasource="giftovationmdb">
Select Distinct(code)
from dealerprice
</cfquery>
<cfloop query="getcodes" >
  <cfquery name="updatepricing" datasource="giftovationmdb">
  update products set dprice = (Select price from dealerprice where code =
'#getcodes.code#')
  where code = '#getcodes.code#'
  </cfquery>
ok</cfloop>

the above code gets this error not sure why any help would be appreciated.

      Operation must use an updateable query.

      The Error Occurred in C:\Inetpub\wwwroot\tools\pricingupdate.cfm: line
10

8 : update products set dprice = (Select price from dealerprice where code
= '#getcodes.code#')
9 : where code = '#getcodes.code#'
10 : </cfquery>
11 :  ok</cfloop>
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to