9999热视频三级毛片AV区|日韩欧美精品狼友观看视频|av在线成人免费AA片|日韩三级AV电影|久久亚洲私人国产精品vA|亚洲无码卡一卡二卡三|手机在线免费看黄色片|婷婷尹人在线婷婷五月手机网|99爱在线播放|欧美成人色情视频品

SQL Server查詢語句過濾重復的數(shù)據(jù)
來源:易賢網(wǎng) 閱讀:4298 次 日期:2014-09-17 15:59:40
溫馨提示:易賢網(wǎng)小編為您整理了“SQL Server查詢語句過濾重復的數(shù)據(jù)”,方便廣大網(wǎng)友查閱!
 

情況一:表中存在完全重復的的數(shù)據(jù),即所有字段內(nèi)容都是相同的

create table #

(用戶ID int, 姓名 varchar(10), 年齡 int )

insert into #

select 111, '張三', 26 union all

select 222, '李四', 25 union all

select 333, '王五', 30 union all

select 111, '張三', 26

方法: select distinct * from #

情況2:表中存在部分數(shù)據(jù)重復的字段,即 重復數(shù)據(jù)中至少有一個字段不重復create table #(用戶ID int, 姓名 varchar(10), 年齡 int, 日期 DateTime )insert into #select 111, '張三', 26 2010-02-23 union allselect 222, '李四', 25 2010-03-13 union allselect 333, '王五', 30 2011-03-25 union allselect 111, '張三', 26 2011-07-07方法:--當兩條重,取日期大的一條

select * from t a

where not exists (select 1 from t where a.用戶ID=用戶ID a.姓名=姓名 and 日期>a.日期)

更多信息請查看IT技術專欄

更多信息請查看數(shù)據(jù)庫
易賢網(wǎng)手機網(wǎng)站地址:SQL Server查詢語句過濾重復的數(shù)據(jù)
關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點

版權所有:易賢網(wǎng)