想查重,但是出了点问题
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)
------解决方案--------------------我晕,当然不一样了
english +chinese= english +chinese
'ab ' + 'b ' = 'a ' + 'bb '
但2个并不一样
------解决方案--------------------select distinct english,chinese from t_abbr
------解决方案--------------------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
楼主的问题是有点奇怪,应该是一样的.
不明白
------解决方案--------------------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)