cheekybuddha
AWF VIP
- Local time
- Today, 15:39
- Joined
- Jul 21, 2014
- Messages
- 2,991
OK, try something like this first:
If that works we can add in the ItemDescription, but you will need to let us know whether it is unique per [Entry No_]/[Item No_] combination.
Code:
SELECT
a.[Entry No_],
a.[Item No_],
MAX(IIf(a.[Source Type] = 37, a.[Source ID], NULL)) AS SalesNo,
MAX(IIf(a.[Source Type] = 5406, a.[Source ID], NULL)) AS ProductionNo
FROM [dbo_KonfAir DRIFTSReservation Entry] a
WHERE a.[Source Type] IN (37, 5406)
GROUP BY
a.[Entry No_],
a.[Item No_]
;