I have the following table:
| intStudentCode | strFavoriteSocialMedia | 
|---|---|
| 1 | |
| 1 | |
| 2 | |
| 3 | TikTok | 
| 4 | Youtube | 
| 5 | |
| 6 | TikTok | 
| 6 | Youtube | 
The table has 8 lines. I want a table having only non-repeating intStudentCode. For Example:
| intStudentCode | strFavoriteSocialMedia | 
|---|---|
| 1 | |
| 2 | |
| 3 | TikTok | 
| 4 | Youtube | 
| 5 | |
| 6 | TikTok | 
I dont have preference if the strFavoriteSocialMedia for intStudentCode = 1 is Facebook or Instagram. The same to intStudentCode = 6. All I want is retrieve a single student line based on intStudentCode. PS: I am using SQL Server 2012, but if you have the solution for another DBMS, it also help.
 
     
     
    