SOQL Group by IN Salesforce

String query = 'SELECT id,CreatedById,Product.Id,POCGrades__c ,fm_pocname__c,product.Name ,Visit.placeId, fm_poccode__c, createdby.LastName,Visit.LastModifiedDate, createddate, ActualBooleanValue'
                + ' FROM retailvisitkpi'
                + ' WHERE createddate = last_month and '
                + ' ( Product.Id = \'01t5j000003tszWAAQ\''
                + ' OR Product.Id = \'01t5j000003tszWAAQ\''
                + ' OR Product.Id = \'01t5j000003tt5nAAA\''
                + ' OR Product.Id = \'01t5j000003tsznAAA\''
                + ' OR Product.Id = \'01t5j000003tt1zAAA\''
                + ' OR Product.Id = \'01t5j000003tt7AAAQ\'' 
                + ' )'; 

I am having trouble to removes duplicate records based on Visit.placeID, can anybody help me out with soql

Read more here: Source link