HI ALL,
Below is my update statement. The issue my facing is , There are multiple rv.DividendsID for single DV.DividendsID in the below statement.
In that i want to concatinate the max(rv.DividendsID) for that DividendID in TableA.
For example. While concatinating, I am getting 1454 and 1455 values for rv.DividendsID . In this the final concatination should
be with 1455.
I hope i am not confusing here. Please help me.
update TableA set Comments=CONCAT(dv.Comments,'** Transaction reversed by DividendID = ', rv.DividendsID), IncludeReversals='Y' FROM TABLEA dv join TABLEB RV ON dv.GroupSeries=rv.GroupSeries and dv.ShortName=rv.ShortName and dv.[CUSIP]=rv.CUSIP and (dv.[CUSIPDescription]=rv.CUSIPDescription or (dv.CUSIPDescription is NULL and rv.CUSIPDescription is NULL)) and dv.[TransactionID]=rv.TransactionID and (dv.[SubType]=rv.SubType or (dv.SubType is NULL and rv.SubType is NULL)) and dv.[Interest]=rv.Interest and dv.[Shares]=rv.Shares and dv.[Rate]=rv.Rate and dv.[ExDate]=rv.ExDate and dv.[PayableDate]=rv.PayableDate and dv.[AddDate]=rv.AddDate and dv.[RecordDate]=rv.RecordDate and (dv.[SecurityType]=rv.SecurityType or (dv.SecurityType is NULL and rv.SecurityType is NULL)) and (dv.[SecurityTypeDescription]=rv.SecurityTypeDescription or (dv.SecurityTypeDescription is NULL and rv.SecurityTypeDescription is NULL)) where dv.DatasetID<rv.DatasetID and isdate(dv.ReversalDate)<>1 and dv.IncludeReversals is NULL