存储过程中的组和总和 [英] group and Sum in Stored procedure

查看:88
本文介绍了存储过程中的组和总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



我真的想要快速帮助以下存储过程......

我的SP工作得非常好。

Hello Experts,

I really want a quick help for the below stored procedure...
My SP works absolutely fine.

DELIMITER $$

DROP PROCEDURE IF EXISTS `spm_itemlocations` $$
CREATE DEFINER=`mysqluser`@`%` PROCEDURE `spm_itemlocations`(tLoc   character(4),
  tItem  character(21),
  tTLine character(52))
BEGIN
set tItem = concat(tItem, '%');

  select icitem, icdsc1, icdsc2, ifloc, ifqoh, ifqcm
  from TESTDATA.VINITMB
  join TESTDATA.VINITEM on icitem = ifitem
  where ifcomp = 1
  and ifdel = 'A'
  and (tLoc = '' or tLoc = ifloc)
  and ifqoh = 0
  and (tItem = '' or icitem like tItem)
  and UCASE(ictrln) like tTLine

  order by ifloc, ifitem;

end $$

DELIMITER ;







当有人说请分组并使用摘要,其中sum(ifqoh)= 0将包括在此内。



这是什么意思?我应该在哪里汇总和分组?



有人可以帮我这个吗?




When someone says "Please group and use a summary where sum(ifqoh) = 0 to be included in this."

What does that mean? where should I sum and group ?

Can someone help me with this please?

推荐答案

DROP PROCEDURE IF EXISTS`spm_itemlocations`
DROP PROCEDURE IF EXISTS `spm_itemlocations`


CREATE DEFINER =`mysqluser` @`%`PROCEDURE`spm_itemlocations`(tLoc character(4),
tItem character(21),
tTLine character(52))
BEGIN
set tItem = concat(tItem,'%');

选择icitem,icdsc1,icdsc2,ifloc,ifqoh,ifqcm
来自TESTDATA.VINITMB
加入TESTDATA.VINITEM on icitem = ifitem
其中ifcomp = 1
和ifdel ='A'
和(tLoc =''或tLoc = ifloc)
和ifqoh = 0
和(tItem =''或icitem like tItem)
和UCASE(ictrln)一样,tline

由ifloc,ifitem订购;

end
CREATE DEFINER=`mysqluser`@`%` PROCEDURE `spm_itemlocations`(tLoc character(4), tItem character(21), tTLine character(52)) BEGIN set tItem = concat(tItem, '%'); select icitem, icdsc1, icdsc2, ifloc, ifqoh, ifqcm from TESTDATA.VINITMB join TESTDATA.VINITEM on icitem = ifitem where ifcomp = 1 and ifdel = 'A' and (tLoc = '' or tLoc = ifloc) and ifqoh = 0 and (tItem = '' or icitem like tItem) and UCASE(ictrln) like tTLine order by ifloc, ifitem; end


DELIMITER;
DELIMITER ;







当有人说请分组并使用摘要,其中sum(ifqoh)= 0将包含在此内。



这是什么意思?我应该在哪里汇总和分组?



有人可以帮帮我吗?




When someone says "Please group and use a summary where sum(ifqoh) = 0 to be included in this."

What does that mean? where should I sum and group ?

Can someone help me with this please?


这篇关于存储过程中的组和总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆