关键语句:distinct
方法一,可以直接搜索单列:
SELECT DISTINCT col from table;
方法二,搜索多个列:
SELECT * FROM table WHERE id in (SELECT MIN(id) FROM table GROUP BY col);
博客列表 >利用SQL语句返回不重复值
关键语句:distinct
方法一,可以直接搜索单列:
SELECT DISTINCT col from table;
方法二,搜索多个列:
SELECT * FROM table WHERE id in (SELECT MIN(id) FROM table GROUP BY col);