Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate output

Status
Not open for further replies.

JCAA

MIS
Jun 22, 2003
65
US
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!!
 
Have you tried [tt]DISTINCTROW[/tt] instead of [tt]DISTINCT[/tt] in your query SQL statement?
 
That did not make a difference :( Any other suggestions. I really appreciate it.
 
I should also mention that [Booking Month] and [Forecasted Sale Month] should always have the same value if Booking month is 02/01/04 Forecasted Sale Month will have to be 02/01/04 as well. Thanks again!

 
I figured it out, this is what I ended up doing adding:
[Booking Month] = [Forecasted Sale
Month]
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top