表:
字段1 字段2 字段3
1 a 900
2 b 800
3 a 700
4 c 600
5 a 900
6 a 600
如何才能筛选掉字段2重复记录?即:字段2 能否只显示出 a b c
字段1 字段2 字段3
1 a 900
2 b 800
3 a 700
4 c 600
5 a 900
6 a 600
如何才能筛选掉字段2重复记录?即:字段2 能否只显示出 a b c
解决方案 »
- 怎更新指定条数的记录,并且知道是否成功
- 为什么在存储过程中会报附近有语法错误 用sql 就正常
- 请问字符串字段大小有没有限制?最大多少字节?与BLOB有何不同?谢谢指教
- 索引
- 请教!有关安装sql server2k的两点疑惑。。。。感谢了!
- 未能建立与(local)的连接Sql –dmo必须使用sqlserver 2005管理工具才能连接到此服务器??
- 统计问题,请高手帮忙,非常谢谢!
- ·发现TOP一大问题。。请求邹老大解答……[100分求解,顶者都有分]
- 不知在sqlserver中怎么看trigger
- 我在sybase中写sp,遇到 update @tablename set ....,好像不支持
- 存储过程中 Sql 参数语法错误 求解
- 求一脚本文件
--> 测试时间:2009-12-09 11:31:28
--> 测试菜鸟:l8r
--> 我的淘宝:《戒色坊》http://shop36766744.taobao.com/if object_id('[TB]') is not null drop table [TB]
create table [TB]([字段1] int,[字段2] varchar(1),[字段3] int)
insert [TB]
select 1,'a',900 union all
select 2,'b',800 union all
select 3,'a',700 union all
select 4,'c',600 union all
select 5,'a',900 union all
select 6,'a',600select * from [TB] t where not exists(select 1 from TB where t.字段2=字段2 and t.字段1>字段1)
/*字段1 字段2 字段3
----------- ---- -----------
1 a 900
2 b 800
4 c 600(所影响的行数为 3 行)*/drop table [TB]
*
from
tb t
where
字段1=(select min(字段1) from tb where t.字段2=字段2)