0
我想知道是否有兩個CR.DestinationDepot記錄,然後將它們連接成像(例如。):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_不幸的是這代碼並沒有解決問題。不管怎樣,謝謝你 –