存储过程中的组和总和 [英] group and Sum in Stored procedure
问题描述
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屋!