本文介绍了使用两个计数功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试在存储过程的一个select语句中使用两个count函数,但是不起作用

Hi
I am trying to use two count function in one select statement in stored procedure but doesn''t works

SELECT DISTINCT COUNT(order),count(Cus),name
FROM MEd inner join Portfolios on MEd .MEd ID = Port.MEd Ref
INNER JOIN Pro on Port.portID = Pro.portRef
INNER JOIN P on Pro.proID = P.proRef
WHERE Port.MEd = @ID
GROUP BY name

推荐答案

SELECT DISTINCT COUNT([order]),count(Cus),name
FROM MEd inner join Portfolios on MEd .MEd ID = Port.MEd Ref
INNER JOIN Pro on Port.portID = Pro.portRef
INNER JOIN P on Pro.proID = P.proRef
WHERE Port.MEd = @ID
GROUP BY name


最好的问候
M.Mitwalli


Best Regards
M.Mitwalli



这篇关于使用两个计数功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 05:41