Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Elite Contributor
Posts: 41
Registered: ‎03-09-2009
Accepted Solution

Hiccup in SQL Code - Please Help

[ Edited ]

Everyone, 

 

I’ve got 2 tables that I am working with here.  One is the Account table and the other is the Account Extension table.  I want to take the AccountmangerID (String-12) from the Account table field and insert that value into the Area_Sales_ManagerID (also String-12) in the Account Extension Table where the AccountmangerID from the Account table is equal to U6UJ9A00002K. 

 

I’ve used the following code but the “Where” statement causes SLX to return a “Failed to parse SQL –“ command.   

 

UPDATE ACCOUNT_EXT

 

SET AREA_SALES_MANAGERID = 'U6UJ9A00002K'

 

WHERE accountmanagerid IN

            (SELET accountmangerid from ACCOUNT           

            WHERE accountmangerid = 'U6UJ9A00002K') ; 

 

If I take out the “Where” command, the command works, but then wants to change over 8,000 records which isn’t a good thing.  I’m looking in the neighborhood of 202 records to be changed. 

 

So, in a nutshell, since I’m not a SQL guru, let alone a novice, what am I missing? 

 

As always, thanks in advance and appreciate the help/another set of eyes looking this over. 

 

J

Message Edited by slsl on 02-08-2010 03:13 PM
Copper Elite Contributor
Posts: 33
Registered: ‎02-10-2009

Re: Hiccup in SQL Code - Please Help

How about something like:

 

update account_ext

set area_sales_managerid = 'U6UJ9A00002K'

where exists (select accountid

from account where account.accountid =

account_ext.accountid

and account.accountmanagerid = 'U6UJ9A00002K')

 

This is assuming that the account and account_ext table are linked by the accountid

Martin Rudnick
Wells Fargo
SalesLogix Product Manager

"When in doubt, log out...and reboot"
Copper Elite Contributor
Posts: 41
Registered: ‎03-09-2009

Re: Hiccup in SQL Code - Please Help

Martin,

 

THANKS!  Always a plus using the correct syntax!

 

Have a good day!

 

I will now!

 

J