I am sure there is a simple solution to my problem. I have the following query but I am getting duplicate records in my output if I have more then one month of input. How do I change my query not to get duplicates in my output. Do I have to write a cross tab query or what is the problem in my logic? I am at a loss why I get duplicates and how I can solve this. Any help is greatly appreciated
SELECT DISTINCT Bookings.Trend, Bookings.[Trend Description], History.[Mktg Mgr], History.Part, History.[Forecasted Sale Units], Bookings.[Booking Amount], Bookings.[Booking Month], History.[Forecasted Sale Month], History.Intl_Dom, Bookings.[Booking Month]
FROM ([ZZZ2 - Item Master Table (MRP and MPS and Other Items)] RIGHT JOIN History ON [ZZZ2 - Item Master Table (MRP and MPS and Other Items)].[Part Number] = History.Part) LEFT JOIN Bookings ON History.Part = Bookings.Part
WHERE (((Bookings.[Booking Month]) Between [Begin Month] And [End Month]) AND ((History.[Forecasted Sale Month]) Between [Begin Month] And [End Month]) AND ((History.Intl_Dom)="Intl") AND ((Bookings.Intl_Dom)="Intl"));
Thanks!!
SELECT DISTINCT Bookings.Trend, Bookings.[Trend Description], History.[Mktg Mgr], History.Part, History.[Forecasted Sale Units], Bookings.[Booking Amount], Bookings.[Booking Month], History.[Forecasted Sale Month], History.Intl_Dom, Bookings.[Booking Month]
FROM ([ZZZ2 - Item Master Table (MRP and MPS and Other Items)] RIGHT JOIN History ON [ZZZ2 - Item Master Table (MRP and MPS and Other Items)].[Part Number] = History.Part) LEFT JOIN Bookings ON History.Part = Bookings.Part
WHERE (((Bookings.[Booking Month]) Between [Begin Month] And [End Month]) AND ((History.[Forecasted Sale Month]) Between [Begin Month] And [End Month]) AND ((History.Intl_Dom)="Intl") AND ((Bookings.Intl_Dom)="Intl"));
Thanks!!