Frank Mamone wrote:
> 
> ROW_ID
> CON_PERSON_UID
> PC_STATUS
> CON_CUST_STATUS
> CON_PR_POSTN
> 
> I need to put the value of PC_STATUS into CON_CUST_STATUS  where
> CON_PERSON_UID matches ROW_ID and marked as CON_PR_POSTN = 'Y'
> 
> Remember this is denormalized data.  So, essentially I need to do a
> self join update. With  MS SQL  I would use this
> 
> UPDATE EIM_CONTACT
> SET EIM_CONTACT.CON_CUST_STAT_CD = EIM_CONTACT1.PC_STATUS 
> FROM EIM_CONTACT , EIM_CONTACT  EIM_CONTACT1
> WHERE EIM_CONTACT.ROW_ID = EIM_CONTACT1.CON_PERSON_UID
> AND CON_PR_POSTN = 'Y'

If that works you need to file a bug with Microsoft. Imagine the 
following dataset:

ROW_ID  CON_PERSON_UID  PC_STATUS  CON_CUST_STATUS  CON_PR_POSTN
x1x                                       ?              Y
ad           x1x              2                          Y
df           x1x              3                          Y

The outcome of your update query on this dataset is undefined. 
Should it set CON_CUST_STATUS in the first row to 2 or to 3?


If you make the database choose consistently between the 2 and 
the 3 (usually through aggregate functions) you have solved the 
"Single row sub-query returns more than one row." error message 
and then it will work.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190981
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to