/*注:以下查询语句直接运行,对执行完毕检查批次行,对于全数字的信息,在系统中检查。 查询结果显示:批次号,库存数量,存货名称*/ SELECT sb.vbatchcode, ro.NONHANDNUM, bi.INVNAME FROM scm_batchcode sb INNER JOIN bd_invbasdoc bi ON sb.PK_INVBASDOC = bi.PK_INVBASDOC LEFT JOIN rmb_onhandnum ro ON sb.vbatchcode = ro.vbatchcode WHERE (sb.vbatchcode IN ( SELECT ssb.vbatchcode FROM scm_batchcode ssb GROUP BY ssb.vbatchcode HAVING COUNT (ssb.vbatchcode) > 1)) AND ro.NONHANDNUM > 0 AND length(sb.vbatchcode)>6 ORDER BY sb.vbatchcode DESC