dailyProductAvailabilities contains a daysOutOfStock which will be the number of days a product has been out of stock. Using this I retrieve records ordered on that. dailyProductAvailabilities` has a relationship to the product so I'm then able to retrieve the product its for. The problem is this now (while I have test data) is just returning repeated products. Is there any way I can add some uniqueness here to ensure I get the top 10 products without duplicates?