select distinct * from table 或select distinct a,b from table看你用哪个!
大侠 用group by 谢谢
select distinct a,b,c from tablename group by a,b,c
字段前面 能不能不带东西??? 就写成 select 字段 from 表.....
select a,b,c from tablename group by a,b,c
錯了啊? 唉,我現在沒SQL SERVER :)
declare @a table (A char(1),B char(1),C char(1)) insert @a select '1', '1', '1' union all select '1', '1', '1' union all select 'A', 'A', 'A' union all select 'A', 'B', 'C' union all select 'A', 'A', 'A' select * from @a group by A,B,C
就写成 select 字段 from 表.....
唉,我現在沒SQL SERVER :)
insert @a
select '1', '1', '1' union all
select '1', '1', '1' union all
select 'A', 'A', 'A' union all
select 'A', 'B', 'C' union all
select 'A', 'A', 'A' select * from @a group by A,B,C