First of all. Is there any opertunity to recode this into a normalised structure?You shouldn't be replicating data like name, contactNumber etc.I'm guessing that only the photo-image changes? -- you have multiple images?If so you can do thisSELECT [name] , [contactNumber] , [city]FROM studentsGROUP BY [name] , [contactNumber] , [city]
orSELECT DISTINCT [name] , [contactNumber] , [city]FROM students
Regards,NB: just read your requirements again. You need all the fields. In that case you are going to have to decide which 1 of the non grouped by items you want. (the max, min, whatever)Something likeSELECTMAX(Id), name, contactnumber, cityMAX(photo-image)FROM studentsGROUP BY, name, contactnumber, city