列A 列B
12 45
13 46
12 45
14 33
12 46
13 46
13 45
如何写出一个SQL得出以下结果,即取出两列中不重复的值
12 45
12 46
13 46
13 45
14 33
select 第一列,第二列 from table group by 第一列,第二列
select distinct A,B from 表名 这样就会同时作用于这两个字段了,在mysql版本5.5测试通过
上面两种方式都可以实现~
select distinct A,B from tableName order by A,B asc