I have table bio
ID   Name    Country   Address
1    Dan     America    A
2    Dan     Japan      B
3    Dan     Canada     C
4    Marcus  China      D
5    Kurtis  Nepal      E
6    Kurtis  Mexico     F
7    Jack    Indonesia  G
I need to select only one from the duplicate value of column "Name". I expect the result like this.
ID   Name    Country   Address
1    Dan     America    A
4    Marcus  China      D
5    Kurtis  Nepal      E
7    Jack    Indonesia  G
I used this query
SET SESSION sql_mode = ( SELECT REPLACE ( @@sql_mode, 'ONLY_FULL_GROUP_BY', '' ) );
Select * from bio group by name;
Is there any other way without using SET SESSION sql_mode = ( SELECT REPLACE ( @@sql_mode, 'ONLY_FULL_GROUP_BY', '' ) ); since if i didn't use that, it return error.
I have tried answer with forpass answer but it run very slow. Here is the Explain query.
id  select_type         table   type    possible_keys   rows    filtered Extra
1   PRIMARY             b       ALL                     1095012  100.00  Using where
2   DEPENDENT SUBQUERY  t       ALL     PRIMARY,semua   1095012  3.33    Range checked for each record (index map: 0x3)
 
     
    