0
CR.DestinationDepotのレコードが2つあるかどうかを調べるために、今すぐ連結する方法とは対照的に(例えば)KNI/KHNのように連結します。何か案は?ありがとうございました。カウントを使用して出現を決定し、データを連結する
select CR.DestinationCountry,
mm.MovementRef,
CR.DestinationDepot,
case when count(CR.DestinationDepot) >= 2 then 'yes' else 'no' end as [statement],
Case when (CR.DestinationCountry <> 'GB') and count(CR.DestinationDepot) >= 2 then CR.DestinationDepot+'/'+CR.DestinationDepot else CR.DestinationDepot end as [DestinationDepot]
FROM dbo.MALExport AS ME
INNER JOIN dbo.movConLink AS MCL ON ME.ConsignmentReference = MCL.ConsignmentReference
INNER JOIN dbo.cgtRoute AS CR ON CR.RouteID = MCL.CMRRouteID
INNER JOIN dbo.movMovement AS MM ON MM.MovementRef = ME.MovementReference
group by cr.DestinationCountry, cr.DestinationDepot, mm.MovementRef
こんにちは@RJ_残念ながら、このコードを実行しても問題が解決しなかった探しているものでなければなりません。とにかくありがとうございました –