本文介绍了如何在存储过程中使用子查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的子查询返回一个值,该值由多个值组成,用逗号分隔。
我的子查询是这样的: -
选择 ApplGLCd 来自 ebreportstructureho
其中 grpname = ' 附录'
,它的输出是这个:-0034,0035,0064,0026,0030,0031,0056
当我使用存储过程的子查询但它没有给出任何排序错误,但它应该返回一些不幸发生的数据。
我尝试过:
SELECT date ,SUM( clcr-cldr) AS ClosingCr FROM ebgltransaction
WHE RE brncd = ' 0002' AND glcd IN (选择 ApplGLCd 来自 ebreportstructureho
其中 grpname = ' 附录' ) AND date BETWEEN ' 20151001' AND 20151031'
GROUP BY date
ORDER BY date
解决案
My sub query returns a single value and that value consists of multiple value which are separated by comma.
My sub query is like this:-
select ApplGLCd from ebreportstructureho where grpname = 'Appendix'
and it's output is this:-0034,0035,0064,0026,0030,0031,0056
When I use the sub query with the Stored Procedure though it don't give any sort of error but it is supposed to return some data which unfortunately not happening.
What I have tried:
SELECT date,SUM(clcr-cldr) AS ClosingCr FROM ebgltransaction WHERE brncd='0002' AND glcd IN (select ApplGLCd from ebreportstructureho where grpname = 'Appendix') AND date BETWEEN '20151001' AND '20151031' GROUP BY date ORDER BY date
解决方案
这篇关于如何在存储过程中使用子查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!