本文介绍了SQL查询(Distict和count)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要获取菜肴名称,并计算其数量b /两个日期。这是我的代码 -



SELECT COUNT(Qty)FROM(SELECT Dishes FROM Temp_Dishes其中Dates ='+ dd.ToString(dd-MM-yyyy )+'GROUP BY Dishes)p



错误消息msg是 - 没有给出一个或多个必需参数的值。

I want to fetch dishes name with count their quantity b/two dates. this is my code--

SELECT COUNT(Qty) FROM (SELECT Dishes FROM Temp_Dishes where Dates='" + dd.ToString("dd-MM-yyyy") + "' GROUP BY Dishes) p

the error msg is-"No value given for one or more required parameters."

推荐答案


SELECT Dishes,SUM(qty) FROM Temp_Dishes where Dates between @startdate and @enddate GROUP BY Dishes


dd.ToString("dd-MM-yyyy") 



write

dd.ToString("yyyy-MM-dd") 



快乐编码!

:)


Happy Coding!
:)


这篇关于SQL查询(Distict和count)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 17:44