Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006

    Unanswered: Update query updates 0 records

    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

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by peljo
    ...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 ) | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts