SELECT A.A,A.B,A.C,B.A........ FROM A,B,C WHERE A.ID=B.ID AND B.ID=C.ID AND A.ID=C.ID

解决方案 »

  1.   

    select
       a.a,b.b,c.c
    from
      tb1 as a inner join tb2 as b on a.关键值=b.关键值 inner join tb3 as c on b.关键值=c.关键值
      

  2.   

    可能没表达很清楚,入参是个code_ID,是表A中的一个字段,根据code_ID检索出表中信息,信息中的另外一个字段是userID,这个userID是表B和C的主键,然后根据userID在表B和C中查询其他信息,能写在一个存储过程里面吗?
      

  3.   

    create proc test 
    (
    @code_ID int
    )
    as
    declare @userID int 
    select  userID=@userID from a where code_ID=@code_IDselect * from b inner join c on b.userID=c.userID where b.userID=@userID