书名重复时取最小ID.
try->
select id=identity(int,1,1),书号,书名,出版社,价格,出版日期,库存 into # from A,B,C where A.书名=C.书名 and A.出版社=B.出版社 
select * from #  t where not exists(select 1 from # where 书名=t.书名 and id<t.id)

解决方案 »

  1.   

    group by 书名  
    这个行不
      

  2.   

    select a.书号,a.书名,a.出版社,a.价格,c.库存,b.出版日期 from A as a,B as b,C as c where a.书号 in (select A.书号 from A,C where A.书名=B.书名 group by A.书号) and A.书号=C.书号 and A.出版社=B.出版社
    试试吧,应该可以
      

  3.   

    我认为你的表建的就有问题,比如说书号1的出版社是a,书号2的出版社也是a,那么在B表中就有两条记录,那么那么这两个表连接的时候 就会产生四条记录,所以是B表和c表,的唯一性不能确定,一种方法是将三个表和为一个表,或是在B和C表加一个书号的列,确保唯一
      

  4.   

    select distinct a.书号 from A a 
    left join B b ON a.出版社=b.出版社
    left join C c ON a.书名=b.书名
      

  5.   

    不好意思,改改select distinct a.书号 from A a 
    left join B b ON a.出版社=b.出版社 
    left join C c ON a.书名=c.书名
      

  6.   

    select A.书号,A.书名,A.出版社,A.价格,C.库存,B.出版日期 from A left join C on A.书号 = C.书号 left join B on A.出版社 = B.出版社 group by A.书号