Skip to content
Advertisement

My Left Join Query in mySql gives duplicate results even after using DISTINCT?

I have tried many solutions to get rid of Duplicate results in Query but no use. Here are my tables:

sparepartorderdetails d table:

and sparepartfeedback fb table:

Now here is my QUERY which gives duplicate results:

Now these are the duplicate results Im getting:

But this Query gives no duplicates if there are no reviews/ratings for an order like for OrderID: 87 it just correctly shows order details and NULL values for Review and Ratings. But when I run it for OrderID: 86 which has Reviews/Ratings, it gives duplicate results.

Below are results that I expect:

Advertisement

Answer

I think you have left out a JOIN condition on the spare part id:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement