mysql select no repeat code example

Example: how to find the top 2 unique records using mysql

mysql> insert into DemoTable1383 values(200,78);
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable1383 values(200,89);
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable1383 values(200,89);
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable1383 values(200,87);
Query OK, 1 row affected (0.29 sec)
mysql> insert into DemoTable1383 values(203,97);
Query OK, 1 row affected (0.20 sec)
mysql> insert into DemoTable1383 values(200,57);
Query OK, 1 row affected (0.17 sec)
insert into DemoTable1383 values(240,20);

Tags:

Sql Example