我想在datagridview中显示多个表的数据 
TableA
ID   SchoolName SchoolNumTableB
ID   FirmName   FirmNumTableC
ID   GovernmentName  GovernmentNum其中三个表通过ID关联起来,怎么通过传递过来的ID取出这三个表满足与已知的ID相同的数据,然后绑定到datagridview中阿  
谢谢啦

解决方案 »

  1.   

    declare @t1 table(id int ,col1 char(3))
    declare @t2 table(id int ,col1 char(3))
    insert @t1 select 1, 'ok1' union all select 2,'0k2'
    insert @t2 select 1, 'ok3' union all select 2,'0k3'select * from @t1 where id = 1
    union all
    select * from @t2 where id = 1/*
    id          col1 
    ----------- ---- 
    1           ok1
    1           ok3(所影响的行数为 2 行)
    */