想查重,但是出了点问题

张海霖 2007-03-14 09:53:44
select english+chinese from t_abbr group by english+chinese 的记录数是50867
select chinese+english from t_abbr group by chinese+english 的记录数是49210


我想删除english和chinese同时重复的,没想到这两个结果怎么不一样呢

english和chinese都是varchar(80)
...全文
163 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
jacobsan 2007-03-14
  • 打赏
  • 举报
回复
应该是一样的。。
张海霖 2007-03-14
  • 打赏
  • 举报
回复
谁能写个语句让我一目了然的看到为什么会结果不同吗?
张海霖 2007-03-14
  • 打赏
  • 举报
回复
abbrid是主键
Select Max(abbrid) From t_abbr group by english, chinese的纪录数是49205
paoluo 2007-03-14
  • 打赏
  • 举报
回复
btut2004(0san.com chinabbr.com mop0.com) ( ) 信誉:100 Blog 2007-03-14 10:04:54 得分: 0


因为我想这样查重
select a.* from t_abbr a inner join (select abbrid=max(abbrid) from t_abbr group by chinese+english) b on a.abbrid!=b.abbrid

但是由于结果不一样,所以我想

select a.* from t_abbr a inner join (select abbrid=max(abbrid) from t_abbr group by english+chinese) b on a.abbrid!=b.abbrid

与上面的语句的结果就不一样。怎么写好呢



-----------
如果abbrid 是關鍵字的話

Select * From t_abbr Where abbrid Not In (Select Max(abbrid) From t_abbr group by english, chinese)
gahade 2007-03-14
  • 打赏
  • 举报
回复
create table t_abbr(chinese varchar(80),english varchar(80))
insert into t_abbr
select '中国','china'
union all select '中国','china'
union all select '中国',NULL
union all select '英国','england'
union all select NULL,'england'
union all select '日本','japan'
union all select '美国',NULL
union all select NULL,'asia'
union all select NULL,NULL

select english+chinese from t_abbr group by english+chinese
select chinese+english from t_abbr group by chinese+english

楼主的问题是有点奇怪,应该是一样的.
不明白
张海霖 2007-03-14
  • 打赏
  • 举报
回复
因为我想这样查重
select a.* from t_abbr a inner join (select abbrid=max(abbrid) from t_abbr group by chinese+english) b on a.abbrid!=b.abbrid

但是由于结果不一样,所以我想

select a.* from t_abbr a inner join (select abbrid=max(abbrid) from t_abbr group by english+chinese) b on a.abbrid!=b.abbrid

与上面的语句的结果就不一样。怎么写好呢
张海霖 2007-03-14
  • 打赏
  • 举报
回复
你确定吗
jacobsan 2007-03-14
  • 打赏
  • 举报
回复
select distinct english,chinese from t_abbr
张海霖 2007-03-14
  • 打赏
  • 举报
回复
哦,那我怎么判断好
wangdehao 2007-03-14
  • 打赏
  • 举报
回复
1+2=2+1不能推导出1=2,2=1来
wangdehao 2007-03-14
  • 打赏
  • 举报
回复
我晕,当然不一样了
english +chinese= english +chinese
'ab' + 'b' = 'a' + 'bb'
但2个并不一样

34,873

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧