前端之家收集整理的这篇文章主要介绍了
[VB.NET]问一条SQL,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
问一条
sql 如何将下面2条
sql合并成1条(“ZT_DATA”和“ZT_DATA_History”格式相同) comm1.CommandText = "SELECT Sum([aa]),Sum([bb]),Sum([cc]),Sum([dd]),Sum([ee]),Sum([ff]) FROM ZT_DATA where 型号= ''qr55 '' " comm1.CommandText = "SELECT Sum([aa]),Sum([ff]) FROM ZT_DATA_History where 型号= ''qr55 '' " __________________________________________________________________________ 用别名。 select a.id,b.id from tab1 a,tab1 b where ... __________________________________________________________________________ 楼上混分直说! 用union all把两句连起来! __________________________________________________________________________ 如果想把2个表的字段整合到一个表,用interboy(冯东)的
方法; 否则,用UNION __________________________________________________________________________ 以上几位说的都可以 看LZ怎么需要了 __________________________________________________________________________ 我要计算ZT_DATA_History和ZT_DATA表中aa,bb,cc,dd,ee,ff字段的和,我不会
sql请大家帮助我写一个完整的语句好吗,谢谢大家了. __________________________________________________________________________ comm1.CommandText = "SELECT Sum(ZT_DATA.[aa])+Sum(ZT_DATA_History.[aa]),Sum(ZT_DATA.[bb])+Sum(ZT_DATA_History.[bb]),Sum(ZT_DATA.[cc])+Sum(ZT_DATA_History.[cc]),Sum(ZT_DATA.[dd])+Sum(ZT_DATA_History.[dd]),Sum(ZT_DATA.[ee])+Sum(ZT_DATA_History.[ee]),Sum(ZT_DATA.[ff])+Sum(ZT_DATA_History.[ff]) FROM ZT_DATA,ZT_DATA_History where ZT_DATA.型号= ''qr55 '' and ZT_DATA_History.型号= ''qr55 '' " __________________________________________________________________________ 同意 __________________________________________________________________________ 同意 capall 的 __________________________________________________________________________ interboy(冯东) 的就可以了 __________________________________________________________________________ 都对 ! __________________________________________________________________________ "SELECT Sum([aa]),Sum([ff]) FROM ZT_DATA where 型号= ''qr55 '' union all SELECT Sum([aa]),Sum([ff]) FROM ZT_DATA_History where 型号= ''qr55 '' " __________________________________________________________________________ 楼上正解 __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263825.html