表tb_question
type | answer |
a | 1 |
a | 1 |
b | 2 |
b | 3 |
c | 4 |
1、作用于单列
select distinct [列名] from [表名];
例如:select distinct type from tb_question ;
运行之后:
type |
a |
b |
c |
2、作用于多列
select distinct [列名1],[列名2] from [表名];
例如:select distinct type,answer from tb_question ;
运行之后:
type | answer |
a | 1 |
b | 2 |
b | 3 |
c | 4 |