Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!umnd-cs!umn-cs!ems!barker From: barker@ems.MN.ORG (Bob W. Barker) Newsgroups: comp.databases Subject: SQL help Message-ID: <464@ems.MN.ORG> Date: Tue, 11-Aug-87 04:12:48 EDT Article-I.D.: ems.464 Posted: Tue Aug 11 04:12:48 1987 Date-Received: Thu, 13-Aug-87 07:08:09 EDT Organization: EMS/McGraw-Hill, Eden Prairie, MN Lines: 32 Keywords: SQL, Unify Ok, I'm relatively new to this SQL buiness but I thought I could figure this one out. So far, no luck. I'm sure this is childs play to some of you. Say I've got a Unify database that contains 2 record types - cusstat and adjust. cusstat contains status info on customer accounts and adjust contains adjustments to customers account balances as well as a flag field to indicate that the adjustment has or hasn't been posted to cusstat. Both cusstat and adjust contain fields with customer names. I'm trying to whip up an SQL that will update the cusstat record of each customer that has corresponding adjustment records where the posted field = N (for NO). I'd also like to change the posted field to 'Y' after doing this but this isn't a real problem so I won't address it here. This SQL doesn't quite work: update cusstat set CS_balance = select CS_balance + A_dollars from cusstat, adjust where CS_custname = A_custname and A_posted = 'N'/ It updates the balances of all customers in cusstat. Now, I imagine I need a 'where' clause to match the update (ie. update cusstat where CS_custname = A_custname or something) but I can't for the life of me get the syntax right! Any help/pointers/suggestions etc. would be appreciated. Thank you! -Bob Barker -------------------------------------------------------------------------------- Bob Barker UUCP: {ihnp4|rutgers|amdahl}!{dayton|meccts}!ems!barker EMS/McGraw-Hill ATT: (612) 829-8200 9855 West 78th Street FAX: (612) 829-1839 Eden Prairie, MN 55344