select * from table1 left join (select * from table2)as b on table1.name=b.name
最后在数据库中用表关联实现你想要的结果,我看上面写的SQL会漏掉一些数据,看看我的select a.name,a.qty,b.age from table1 a left join table2 b on a.name=b.name union select a.name,b.qty,a.age from table2 a left join table1 b on a.name=b.name
from table1 a left join table1 b on a.name=b.name
2、也可以取到dataset的两个datatable之后,用linq join,来关联形成一个数据库,显示到gridview中。
from table1 a left join table2 b on a.name=b.name
union
select a.name,b.qty,a.age
from table2 a left join table1 b on a.name=b.name
http://blog.csdn.net/dotnetstudio/article/details/10379239