Foxtable(狐表)用户栏目专家坐堂 → [求助]SQLCompute代码优化


  共有3077人关注过本帖树形打印复制链接

主题:[求助]SQLCompute代码优化

帅哥哟,离线,有人找我吗?
rjh4078
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3355 积分:24732 威望:0 精华:0 注册:2012/3/26 21:47:00
  发帖心情 Post By:2014/11/14 21:02:00 [显示全部帖子]

用sql语句吧

先建个查询窗口 加个表控件 然后把下面代码生成的数据表绑定过去 或者直接fill

dim cmd as new sqlcommand

cmd.数据源名称=

cmd.sql语句="select 物流编码,外协仓,成品仓,电子仓 from(select 物料编码,(select sum(数量)  from{出入库表} b where a.物料编码=b.物料编码 and b.入库仓='外协仓') -(select sum(数量)  from{出入库表} b where a.物料编码=b.物料编码 and b.出库仓='外协仓') as 外协仓,(select sum(数量)  from{出入库表} b where a.物料编码=b.物料编码 and b.入库仓='成品仓') -(select sum(数量)  from{出入库表} b where a.物料编码=b.物料编码 and b.出库仓='成品仓') as 成品仓,(select sum(数量)  from{出入库表} b where a.物料编码=b.物料编码 and b.入库仓='电子仓') -(select sum(数量)  from{出入库表} b where a.物料编码=b.物料编码 and b.出库仓='电子仓仓') as 电子仓 from{物料信息表} a) as b"

 

平板上打的 可能有标点错误 思路是这样的  最好上个例子


 回到顶部