| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 476 人关注过本帖
标题:关于去掉重复数据问题????
只看楼主 加入收藏
yuanquan0104
Rank: 1
等 级:新手上路
帖 子:69
专家分:0
注 册:2005-7-8
收藏
 问题点数:0 回复次数:1 
关于去掉重复数据问题????
SELECT m_result_detail.Link, m_result.ID, m_result.Enable, m_result.DateTime, m_result.Master , m_result.Path , m_result.Name, m_result.Speciality, m_result.Team, m_result.Duty, m_result.Remark, FROM m_result INNER JOIN m_result_detail ON m_result.ID = m_result_detail.Link WHERE HandleWork = 0
这条语句中的Path是重复数据怎么不让它重复,请指教。

DISTINCT 这个关键字肯定不行,会的些个例子。谢谢!
搜索更多相关主题的帖子: 数据 
2006-07-07 10:59
arraylist
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-7-7
收藏
得分:0 

试:

SELECT m_result_detail.Link, m_result.ID, m_result.Enable, m_result.DateTime, m_result.Master , m_result.Path , m_result.Name, m_result.Speciality, m_result.Team, m_result.Duty, m_result.Remark into # FROM m_result INNER JOIN m_result_detail ON m_result.ID = m_result_detail.Link WHERE HandleWork = 0

declare @max int,@path varchar(300)
declare cur_rows cursor local for select path,count(*) from # group by path having count(*) > 1
open cur_rows
FETCH NEXT FROM cur_rows into @path,@max
WHILE @@FETCH_STATUS = 0
BEGIN
set rowcount @max

delete # where path = @path

FETCH NEXT FROM cur_rows into @path,@max
end
close cur_rows
set rowcount 0

2006-07-07 12:54
快速回复:关于去掉重复数据问题????
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016006 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved