请高手帮小弟我看下多表查询不显示重复记录有关问题

请高手帮我看下多表查询不显示重复记录问题
我设计了二个表
A表
cid,a,b,c,cno
B表
tid e,f,tno
 查询sql=select disditnct A.cid,A.a,A.b,A.c,B.e,B.f from A inner join B on A.cno=B.tno
总是出现少数重复记录
用group by 也一样,现在不知如何处理了,请高手指点下我吧?
------解决方案--------------------
declare @tb1 table (aid int identity,a nvarchar(50),b nvarchar(50),c nvarchar(50),ano int)
declare @tb2 table (bid int identity,d nvarchar(50),e nvarchar(50),f nvarchar(50),bno int)
insert into @tb1 (a,b,c,ano) values(1,1,1,1),(2,2,2,2),(1,2,3,1)
insert into @tb2 (d,e,f,bno) values(1,1,1,1),(2,2,2,2),(1,2,3,3)
select Distinct * from @tb1 a inner join @tb2 b on a.ano=b.bno order by ano


不明白你说的重复是什么,是要 ano,bno相同的也只出现一次么?
------解决方案--------------------
这个情况不适合用表连接,用子查询
select a.a (select b.a from t_b b where  b.b = a.b) as b where a.c like '%c%';
------解决方案--------------------
declare @tb1 table (aid int identity,a nvarchar(50),b nvarchar(50),c nvarchar(50),ano int)
declare @tb2 table (bid int identity,d nvarchar(50),e nvarchar(50),f nvarchar(50),bno int)
insert into @tb1 (a,b,c,ano) values(1,1,1,1),(2,2,2,2),(1,2,3,1)
insert into @tb2 (d,e,f,bno) values(1,1,1,1),(2,2,2,2),(1,2,3,3)
select * from (select * from @tb1 where aid in (select max(aid) from @tb1 group by ano)) a inner join (select * from @tb2 where bid in (select max(bid) from @tb2 group by bno)) b on a.ano=b.bno order by ano


关键是你所说的重复需要按什么样的规则去除

最好你把现在搜索到的记录列一个出来,然后把期望的结果列出来,这样别人才能明白你到底想干什么