On Wed, 13 Jun 2007, David Scott wrote: > > I am trying to update the column CreditCode in a table extract using data > from another table CreditCodes, which has columns CreditCode and > Consumer_No. > > I have been given the following sql which works on another database (not > sure which and it is late at night so I can't ring up and ask) > > update extract > set CustomerCreditCode = b.CreditCode > from extract a > inner join CreditCodes b > on a.ConsumerNO = b.Consumer_No; > > This gives an error in mysql: > ERROR 1064: You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use near > 'from extract a > inner join CreditCodes b > on a.ConsumerNO = b.Cons > > Can anyone translate it into correct mysql syntax for me?
Try: UPDATE extract, CreditCodes SET extract.CustomerCreditCode = CreditCodes.CreditCode WHERE extract.ConsumerNO = CreditCodes.Consumer_No; You should probably try this on a scratch database or at least take a backup first. Gordan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]