我有2条sql查询。
首先选择:
string sql1 ="@select ( ...... )"
DbCommand command1 = db.GetSqlStringCommand(sql1);
DataTable dt1 = base.Select(command1);
第二次选择:
string sql2 ="@select ( ...... )"
DbCommand command = db.GetSqlStringCommand(sql2);
DataTable dt2 = base.Select(command);
我想要第一个结果集dt1,然后第二个结果集dt2。最后,我想将dt2列添加到dt1中。来自C#
答案 0 :(得分:0)
假设两个查询中的列相同,最简单的方法是使用union all
string sql = "@select ( ...... ) union all @select ( ...... )"
答案 1 :(得分:0)