Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update query updates 0 records

Status
Not open for further replies.

peljo

Technical User
Joined
Mar 3, 2006
Messages
91
Location
BG
My query does not update and i guess i have built it false.From 2 tables, orders and orders1, having identical structire but with different ID, i want to to copy the order number from table orders1, there is only one record there, and paste in on the field paragonsum in the table orders. In other words, i i want to update the field paragonsum from the table orders to be equal to the field orderif from the tble orders1.I get no errors but o records are updated.Could i update it?

My sql is :
UPDATE orders INNER JOIN orders1 ON [orders].[orderid]=[orders1].[orderid] SET orders.paragonsum = [orders1].[orderid];

gives no errors, but updates 0 records
 
Have you checked using a Select query that there are records to update?
 
... having identical structire but with different ID
if orders1 has only one row with a different ID, then how did you expect the following to work...


ON [orders].[orderid]=[orders1].[orderid]


try this --

UPDATE orders
SET paragonsum =
( SELECT max(orderid) FROM orders1 )





r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top