如何同时执行两条sql语句

来源:百度知道 编辑:UC知道 时间:2024/09/22 22:36:07
在c#中如何同时执行如下的这两条SQL语句,结果要求在一个表里显示。求高人指点!
select s.wkid,s.wkname,t.retime ,t.traffic*60
from river_calresult t,ph_duanm_weikou s
where t.rno=s.dmno and t.overflowflag=3

select s.wkid,s.wkname,t.retime ,t.traffic*60
from river_calresult t,ph_duanm_weikou s
where t.rno=s.dmno and t.overflowflag=s.shore
group by( s.wkid,s.wkname,t.retime ,t.traffic*60)

select s.wkid,s.wkname,t.retime ,t.traffic*60
from river_calresult t,ph_duanm_weikou s
where t.rno=s.dmno and t.overflowflag=3

union
{

select s.wkid,s.wkname,t.retime ,t.traffic*60
from river_calresult t,ph_duanm_weikou s
where t.rno=s.dmno and t.overflowflag=s.shore
group by( s.wkid,s.wkname,t.retime ,t.traffic*60)

}

select s.wkid,s.wkname,t.retime ,t.traffic*60
from river_calresult t,ph_duanm_weikou s
where t.rno=s.dmno and t.overflowflag=3

union

select s.wkid,s.wkname,t.retime ,t.traffic*60
from river_calresult t,ph_duanm_weikou s
where t.rno=s.dmno and t.overflowflag=s.shore
group by( s.wkid,s.wkname,t.retime ,t.traffic*60)

用union 或 union all将两个SQL串起来
union会消除重复资料
union all不会消除重复资料

使用union all,你可以调试下。

同时选中,点击运行按钮,就可以执行