Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Server updating with join issue

$
0
0

Could someone explain to me why this update script isn't behaving the way I think it should. I'm currently running the following script:

SQL
UPDATE[PO_RECVR_HIST]SET[PO_RECVR_HIST].[REF]=(CASE-- Place MUD or HOCKEY in receiver header reference fieldsWHENcoalesce([IM_ITEM].[ATTR_COD_1],'')='MUD'THEN'MUD'WHENcoalesce([IM_ITEM].[ATTR_COD_1],'')='HOCKEY'THEN'HOCKEY'ELSEcoalesce([PO_RECVR_HIST].[REF],[PO_RECVR_HIST].[REF])END)FROM[PO_RECVR_HIST]LEFTJOIN[PO_RECVR_HIST_LIN]ON-- Acquire all the line information for each receiver header[PO_RECVR_HIST].[RECVR_NO]=[PO_RECVR_HIST_LIN].[RECVR_NO]LEFTJOIN[IM_ITEM]ON-- Acquire all the item information (specifically attribute code 1) for each line item on the receiver[PO_RECVR_HIST_LIN].[ITEM_NO]=[IM_ITEM].[ITEM_NO]

I'm trying to run this script on the PO_RECVR_HIST...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>