回答編集履歴
1
調整
    
        answer	
    CHANGED
    
    | 
         @@ -1,3 +1,4 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            データ作成
         
     | 
| 
       1 
2 
     | 
    
         
             
            ```SQL
         
     | 
| 
       2 
3 
     | 
    
         
             
            create table tbl(ID int primary key,NAME varchar(10),KIND int);
         
     | 
| 
       3 
4 
     | 
    
         
             
            insert into tbl values
         
     | 
| 
         @@ -11,7 +12,16 @@ 
     | 
|
| 
       11 
12 
     | 
    
         
             
            (8,'A',1),
         
     | 
| 
       12 
13 
     | 
    
         
             
            (9,'A',1);
         
     | 
| 
       13 
14 
     | 
    
         
             
            ;
         
     | 
| 
      
 15 
     | 
    
         
            +
            ```
         
     | 
| 
      
 16 
     | 
    
         
            +
            要素がID,NAME,KINDしかないなら
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
            ```SQL
         
     | 
| 
      
 19 
     | 
    
         
            +
            select min(ID) as ID,NAME,KIND
         
     | 
| 
      
 20 
     | 
    
         
            +
            from tbl
         
     | 
| 
      
 21 
     | 
    
         
            +
            group by NAME,KIND;
         
     | 
| 
      
 22 
     | 
    
         
            +
            ```
         
     | 
| 
      
 23 
     | 
    
         
            +
            他に要素があるならこんな感じ
         
     | 
| 
      
 24 
     | 
    
         
            +
            ```SQL
         
     | 
| 
       15 
25 
     | 
    
         
             
            select * from tbl as t1
         
     | 
| 
       16 
26 
     | 
    
         
             
            where not exists(
         
     | 
| 
       17 
27 
     | 
    
         
             
            select 1 from tbl where 1
         
     | 
| 
         @@ -19,4 +29,5 @@ 
     | 
|
| 
       19 
29 
     | 
    
         
             
            and KIND=t1.KIND
         
     | 
| 
       20 
30 
     | 
    
         
             
            and ID<t1.ID
         
     | 
| 
       21 
31 
     | 
    
         
             
            );
         
     | 
| 
       22 
     | 
    
         
            -
            ```
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     |